Re: Simulating ASP/ADO commands in PHP
| From: | Manuel Lemos | Date: | Fri, 08 Sep 2000 23:08:54 +0000 |
| Subject: | Re: Simulating ASP/ADO commands in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15965@lists.php.net to get a copy of this message | ||
Hello Stephen,
On 08-Sep-00 09:01:43, you wrote:
>I use ASP quite a bit. In ASP there are commands that basically say "I want
>to display 5 records at a time out of this recordset." This makes it easy
>to tailor the viewing of recordsets. It also makes it easy to create
>navigation buttons to jump to any particular page. These commands in ASP
>are: AbsolutePage, PageCount, PageSize.
>To simulate this in PHP I can obviously get a count of returned records in a
>result set and form a loop to display that many at a time. How would I set
>it up (what commands) that would allow me to say "jump to the 3rd page -
>which would be records 11 - 15 if displaying 5 at a time"?
What you want depends a lot on the database you are using. If you are looking
for a database independent solution, you may want to try Metabase PHP
database abstraction package that has a facility that lets you ask the
database server for a specific range of result set rows even before you
execute a query.
Just use the MetabaseSetSelectedRowRange($database,$first,$limit) function
and it will work like with the MySQL limit clause except that it works with
most of the other supported DBMS.
Metabase also allows you to do random access to a the rows of a result set
also with the ability to count the number of rows even on DBMS that don't
have specific function for that like there is mysql_num_rows for MySQL.
Metabase is available 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
--