Ehm..
I mean the rownumber in the resultset.
The first query you do is one that returns all records what meet certain requirements, like a date or a name.
Lets say you have a user database with 5 people named 'john'
Your first query would be
SELECT * FROM users WHERE name='john'
this will give you a resultset with 5 records.
Print all these to the screen and let the user make his choice.
Now to get the choice of the user, you'd run a query like
SELECT * FROM users WHERE id = 65;
to get the record that the user clicked on.
Now you'd have to do two more queries to get the previous and next buttons.
But, if you don't do
SELECT FROM users WHERE id = 65;
but instead, do
SELECT FROM users WHERE name='john'
again, you can put all the records from the resultset into an array.
Then, you can loop through the array untill you find the record with ID=65.
The previous element in the array is the previous record, and the next element is the next record.
That should do it.