Re: paging methodology
| From: | Travis Low | Date: | Tue, 04 May 2004 20:07:41 +0000 |
| Subject: | Re: paging methodology | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185344@lists.php.net to get a copy of this message | ||
I usually use twin sql queries, one for determining the total possible record count, and the other to get the actual data to be displayed. For the second query, I rely on a request parameter or session variable to know which record number to start from (e.g. 1st, 50th, etc.), and then I select a range of records, starting from that record. I usually make the range size (page size) configurable. The method of selecting the range varies widely from database to database.
cheers,
Travis
Chris W. Parker wrote:
hey everyone, i'm not really looking for any code in this email but instead a methodology for record paging. so far the only method i know of is the following (plain english pseudo code): <?chris if (search is being performed first time) { query db and return entire result set; count number of records; } else { $_GET record count from initial query performed above; } use the total number of records to determine how many pages to display; perform search utilizing the LIMIT clause; show results; ?> what other methods are there aside from this? chris.-- Travis Low <mailto:travis@dawnstar.com> <http://www.dawnstar.com>