Prevous and next (pagination)

I have a query to display several records

SELECT rack_id FROM racks WHERE location = "Room 8";

The PK for the table is rack_id
When I run the query I get
7,8,9,10
But when I add a rack into the rack table, then run the query I get
7,8,9,10,15
This messes up my previous and next links cause all id say is look for the rack_id + or - 1 to get to the previous or next, but I realize this wouldnt work if I added a rack out of order.
So what I was thinking is instead of adding + or - 1 for this, is there a way to go to the next of previous index in the array, would that be the way around this?

I realise this is using scandir() but it might give you an idea of how to go about it:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.