Skip to main content
Known Participant
February 24, 2012
Question

After updating record, how do I go to next record?

  • February 24, 2012
  • 1 reply
  • 866 views

After updating a record, I want it to take me to the next record.

I get that if I want to go to a particular page the code is:

$updateGoTo = "master_list.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

    $updateGoTo .= $_SERVER['QUERY_STRING'];

But since the entry I am updating is always changing (and there for the next entry as well) I am confused.

I thought it would be something like:

update_entry.php?beer_id%+1?

But no such luck.

This topic has been closed for replies.

1 reply

Participating Frequently
February 24, 2012

Please define what you mean by 'next record'.

ggourdeAuthor
Known Participant
February 24, 2012

Sorry, brengent,

The next record in the table according to the primary key. 

So if I just updated the record for beer_id (my primary) '1,' when I submit the update I'd like to automatically go to the update page populated with information about beer_id='2'.

Participating Frequently
February 24, 2012

>update_entry.php?beer_id%+1?

OK, there are several ways to do it. I don't write PHP code, but it would be something like:

$myURL = "update_entry.php?beer_id =" . $current_id +1