You should also add an ORDER BY clause in there, as the SQL standard doesn't 
guarantee the order that rows are retrieved in. There's a chance that 
you'll get, say, 20 rows on the first page, go to the second page and get 
some of the rows you've already seen on the first page. If you use an ORDER 
BY, you'll at least guarantee that you'll get them in the same order each 
time.

J


Kevin Stone wrote:

> $query = "SELECT * FROM mytable LIMIT $i, 20";
> 
> Where 20 is the number of rows to retrieve and $i is the starting row.
> 
> By incrementing $i + 20 you can do next, prev buttons, or parse the total
> number of rows into page links (prev - 1, 2, 3, 4, 5, 6.. 10.. 20 - next).
> 
> Search www.mysql.com for more information about using LIMIT in your
> queries.
> 
> -Kevin
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to