paginated query results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

paginated query results

Post by andym01480 »

I have a basic cart that outputs a table based on one of 3 user queries - keyword search, main category or sub category. Those are inputted to the cart through the URL from links and would be cleaned $_REQUEST variables.

Currently that could yield 144 results, which looks amateurish!

If I want to paginate the results so there aren't two many.

My thoughts

Option 1) $_REQUEST variables containing the original query and pagination variables...
Do the query
Work out how many rows
Work out how many pages
Check what page no from

Code: Select all

$_REQUEST['pageno']
, default to 1
Create Page no links
Output current page of results

Option 2) use Session variables to do the same

Option 3) ????

What is the best way to do it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You may be interested in the paginator arborint and timvw, among others, helped bang out in .. Theory I think it was.
Post Reply