How can I select the next row in my db.. for example i'm looking now at row 5 or MyID 5.. I want to have a link to the next one but this may not be 6 because MyID 6 could have been deleted only leaving MyID 7... how can i get SQL to work out that the next row to view is MyID 7's row???
One possibility:
$lastID = 5; $query = "SELECT colum_list FROM table_name WHERE MyID > $lastID ORDER BY MyID ASC LIMIT 1";
In other words, you would use the current ID in the link, and your query would then be based off of that ID (as in, you tell MySQL to give you the row with an ID greater than number xx).