Hello,

Lerp wrote:
> 
> Hi all, I have a small php app where I'd like to incorporate page throughs
> of records, say 10 at a time.
> 
> I'm using sqlServer and have run into a problem using the LIMIT statement
> within my query.
> 
> Code:
> $sqls = "SELECT consultantid, firstname, lastname, city, country, category,
> yearsexp FROM CONSULTANT ORDER BY consultantid DESC LIMIT $var1, $var2" ;
> 
> So how the heck do I get around this problem since I've discovered that the
> LIMIT statement will not work with sqlServer??? :)

You may want to use TOP clause if you are using MS SQL server 7 or
better, but I recommend that you use server side cursors, to skip any
initial rows thus avoiding returning them from the server.

You may also want to try Metabase that is a PHP database abstraction
package that simplifies your problem by just making simple call before
executing a limited query to specify the row range limits.

There is also a ready to use class that displays paged queries in HTML
tables already with links to go back and forth, next, previous, first
and last pages.

Metabase is freely available here:

http://phpclasses.upperdesign.com/browse.html/package/20

and the query paging class is here:

http://phpclasses.upperdesign.com/browse.html/package/130

An example of output of this class can be seen here:

http://phpclasses.upperdesign.com/browse.html/file/414/view/1/name/test_database_table_page.html

Regards,
Manuel Lemos

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to