Page 1 of 1

[SOLVED]How can I find out what page a particular record is

Posted: Mon Mar 12, 2007 12:58 pm
by Begby
I am using record paging with the limit clause and a paginate menu.

What I would like to do is be able to have someone fill in a text box with an identifier, then have the script 'jump' to the page that that identifier appears on.

For instance, if there are 4537 pages with 40 records each, and the user wants to go the page with bin JG16, they won't have to hunt through page after page.

I could implement a search, but I would really prefer to be able to jump to a specific page so that they can continue where they left off if for instance they are spending a week doing inventory and would like to start back where they left off.


The problem is the number of records which is currently about 45,000. I do not want to have to query them all to find out where the record lies. Is this possible to do?

Posted: Mon Mar 12, 2007 1:10 pm
by feyd
If you use the ORDER BY clause you can perform a COUNT() query with a WHERE clause that specifies to look for records lower than "XYZ". Adding one will tell you the exact index. Divide that by the quantity per page (rounding up) and you have the page number.

Posted: Mon Mar 12, 2007 1:13 pm
by Begby
feyd wrote:If you use the ORDER BY clause you can perform a COUNT() query with a WHERE clause that specifies to look for records lower than "XYZ". Adding one will tell you the exact index. Divide that by the quantity per page (rounding up) and you have the page number.

You rock! Thanks.