Two sources of code: 1. EZSql (if you are using that library) has a library for paging. 2. PHP Cookbook has some code you can use. There's lots of other good stuff in there too.
Jeff -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dell Sala Sent: Thursday, October 18, 2007 3:06 PM To: NYPHP Talk Subject: [nyphp-talk] Paging Strategies Every time I implement paging for search results I end up using different approaches, but I'm never happy with any of them. Am I missing a simpler, more "correct" solution here? Here's what I've tried: 1) TWO-QUERY APPROACH on every page view: - step 1: execute search query with a "SELECT count(*) " to get the total record count - step 2: run the search again with the appropriate LIMIT clause to retrieve the records I need for the current page 2) ONE QUERY, SEEK TO RESULTS on every page view: - step 1: execute search query - step 2: use *_data_seek() to move to the right slice of results for the current page 3) ONE QUERY, CACHE EVERYTHING on the first page view: - execute search query, fetch all results, and cache them on every other page view: - retrieve the right slice of results from the cache -- Dell _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php
