Re: Database Paging using MSSQL 2000
| From: | Manuel Lemos | Date: | Sun, 25 Feb 2001 02:15:02 +0000 |
| Subject: | Re: Database Paging using MSSQL 2000 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41529@lists.php.net to get a copy of this message | ||
Hello Ankur,
On 21-Feb-01 06:09:04, you wrote:
>I am implementing a database application using PHP4 and MSSQL2000. I have a
>database table which has a large no. of tuples. I want to display the data in
>the form of pages with Prev Next buttons.
>I wanted to know if there is some syntax in the MSSQL Select statement which
>can allow me to limit the no. of records being returned. I am lookin at
>functionality which is similar to LIMIT in Mysql.
>for ex, LIMIT 10,10 in MYSQL returns to me a maximum of 10 records starting
>from the 10th record in the returned recordset.
>is there any similar functionality available in MSSQL.
You need to use server side cursors. You may want to look how that is done
in Metabase, a PHP database independent package that has a function
MetabaseSetSelectedRowRange($database,$first,$limit) that may be used
before executing a query and it works like if you are using the
LIMIT $first,$limit query of MySQL.
You may want get Metabase for free here:
http://phpclasses.UpperDesign.com/browse.html/package/20
You may also want to look into this Query result table display class that
uses this Metabase feature to display query results split in pages:
http://phpclasses.UpperDesign.com/browse.html/package/130
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
--