Re: Previous/Next coding
| From: | Manuel Lemos | Date: | Mon, 11 Sep 2000 23:19:38 +0000 |
| Subject: | Re: Previous/Next coding | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2809@lists.php.net to get a copy of this message | ||
Hello Todd,
On 11-Sep-00 15:08:02, you wrote:
>Is there an example of how one can have First-Previous-Next-Last buttons
>for viewing a set number of records is a Result set?
Since HTTP is not a persistent protocol, it is not easy if possible at all
to create a sort of scroll cursor for what you want.
Assuming that your records do not change between subsquent accesses to the
Web page that display their contents, you may reference records by the
appearence order in the result set of SELECT query. That what you may
execute the query by restricting the returned records to a range of a
single record with and given order number.
If you were using MySQL you could use the LIMIT clause like this:
SELECT your_rows FROM your_tables WHERE your conditions LIMIT record_number,1
If you are not using MySQL, you achive a similar effect using Metabase PHP
database abstraction page in a way that is portable between different DBMS.
All you need to do is to use this right before you execute your query with
Metabase calls.
MetabaseSetSelectedRowRange($database_handle,$record_number,1);
Metabase may be found for free here:
http://phpclasses.UpperDesign.com/browse.html/package/20
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--