You don't mention which dbms you are using, so I'm speaking in generalities here. But most of the things that php support provide genuine sql interfaces, and one of the attributes of SQL is that there is no such thing as a record number, at least not as far as the user can see. So you have to arrange some other means of determining this.
What you are referring to as a "record number" is actually a relative row number within a particular result set. Whether this can help you in your Prev/Next depends on how the set is ORDERED to begin with, and whether the column in question is unique. For example, if you're looking through a set of customer records in order by customer number, your query for Next can simply say 'where customer_id > $current_id limit 1' and you'll get the next record. Prev is quite a bit harder, and if you're going through the records in last name, first name order you're in big trouble since these don't have to be unique.
But I guess if your dbms fully supports LIMIT and the underlying query isn't too expensive to recompute each time, you could simply use LIMIT 1, $n on all the queries and then prev is just '$n-1'. This would only be subject to failure due to other uses adding records. For example, if you query says
select * from customer order by upper(last),upper(first) limit 1,$n
and you're currently looking at Smith, John and another user adds a record for Anan, Kofi then when you hit the Prev button you're gonna see John Smith all over again.