Saturday, March 28, 2009

mySQL query result issue (1)

How to display a limiting  database query results on a page and use next button to browse more results?

MySQL's LIMIT option can be used for this. Just like you can use it to limit results, you can use it to show rows that aren't at the beginning of the result set.

For example, just adding 'LIMIT 10' to the end of a query would show the first 10 results. Appending 'LIMIT 11,10' will show 10 results, starting from the 11th, or the next 10 results. Appending 'LIMIT 21,10' will show the third set of 10.

0 comments:

Post a Comment