Forum Moderators: open
I'm thinking I can do this in PHP, but I really don't want to have to load the entire data set into an array and figure it out that way if there's a SQL method.
Otherwise create an ordered result set in a temporary table, using INSERT INTO TABLE... SELECT. Make sure to create, in essence, an auto-increment column. (With a SQL variable and a bit of trivial math in the SELECT.) Now, you can look-up the record in the temporary result table, and fetch the "position" column you added, and divide by the page size.
I created a list of the records as an associative array with the id field as the array key and the position as the value ($i++ in the loop). Then I just access $array['id'] to get the position.