Is there a way in PHP/mySQL to figure out the next/prev primary key in the database? I have a web based db navigation script that shows 1 record at a time. The primary key is called "contact_id" which is an auto incremented number. I would like to add next/prev links but i cannot simply add/subtract from the contact_id because the numbers are not continuous (certain records may have been deleted). There must be some way to poll the db and calculate the next/prev numbers based on the current number.