Posted by Tyno Gendo on 04/19/07 09:44
Man-wai Chang wrote:
> I would like to do something like this:
>
> select * from myTable where ... pagesize 10 page 1
>
> How could I do it elegantly in:
>
> 1. PHP+MySQL before MySQL 5 (without stored procedures)
> 2. MySQL alone (with stored procedures)
>
Take a look at LIMIT in MySQL, and use a page offset variable in your PHP.
I usually do two queries, one to get how many results there would be
without pagination, and another to get the results within the page range.
Don't know if this is the best way to do it though, i'd be interested in
others replies myself.
[Back to original message]
|