Pagination question
Posted: Sat Apr 17, 2010 6:00 am
Say if I have a search page on my site that allows many search options and criterias, and results are generally a couple of hundreds records for each search, pulled from a database of around 20,000 records, and I'll need to paginate the results.
I'm thinking of the following algorithm, which is what most PHP pagination scripts I've found out there are doing:
Search 20,000 records based on specified search criteria and count the number of results.
Total count of results / Number of records I want to display per page, and display the pagination links accordingly.
Display results for the current page.
That pretty much works, but the thing is.. seems like I'll have to peform the search again everytime I want to look at another page of the results, in which case I'll have to somehow pass my search criterias for this search through GET or POST in order for the search to be done again? Is it supposed to be this way?
I'm thinking of the following algorithm, which is what most PHP pagination scripts I've found out there are doing:
Search 20,000 records based on specified search criteria and count the number of results.
Total count of results / Number of records I want to display per page, and display the pagination links accordingly.
Display results for the current page.
That pretty much works, but the thing is.. seems like I'll have to peform the search again everytime I want to look at another page of the results, in which case I'll have to somehow pass my search criterias for this search through GET or POST in order for the search to be done again? Is it supposed to be this way?