Ron Piggott (PHP) wrote:
I am wondering what the mySQL commands are to display the next 10
records / previous 10 records.
I am wondering how you pass a variable through a PHP script so the
script knows which next or previous 10 entries to display.  (Especially
since this is all variable driven)  Would you do something like ?next=21
and ?previous=1 as part of the URL link to know where your query should
begin?  I do know the LIMIT = mySQL command to limit 10 items to be

How do you tell when there aren't 10 more entries left to display?  IE
If there are 46 records in a table and you are displaying 40 to 46 you
don't want to offer a link to display records 50 to 59.

Hi Ron,

To display a range in mysql you can simply use the 'limit' parameter.

eg: "select * from table limit 100,10"

I would normally just pass the offset through the get var.

You don't have to worry if there aren't 10 left to display as limit will just return the rows that are left.

For complete non results (like record 59 of 46) there are a few schools of though, like doing a max/min on the id field or a row count to see whats the possible range.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to