To enable 'previous' and 'next' arrows on a page, I need a way to query my database and find the two records that have next lowest and the next highest value of the primary key field "primaryid".
I realize that these values won't necessary be the current record "-1" or "+1", since after deletions a newly created record doesn't have just the next value up from the existing highest value for the primary key field.
If it helps, the database has another unique field "uniqueid"m apart from the primary key field, with random but unique 6-digit numbers. A variable ("$CurrentUnique") is already set on the page for the current record of this "uniqueid" field. So up to now all I have to identify the current record (being displayed on the page) is:
$CurrentRecord = mysql_query("SELECT * FROM mytable WHERE uniqueid='$CurrentUnique'");
What I want to do is to make a query to select (values from) the records with the next lowest and next highest values of the primary key fields, relative to this current record (if they both exist, of course, since one may by chance be the lowest or highest value), and to assign their values to variables.