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