Forum Moderators: coopster

Message Too Old, No Replies

mysql writing results from 51 to 100

         

rokec

8:26 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



Can someone write me a mysql_query code which will get me results from 51 to 100 from $database?

Don't suggest me working with indexes, because i'm also deleting some rows (for example #1 is filled #2 is not, #3 is...)

Thanks for every word!

whoisgregg

9:24 pm on Sep 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The LIMIT statement will be of help here...

SELECT * FROM `tablename` ORDER BY `date` DESC LIMIT 0,50; // fetches rows 1-50
SELECT * FROM `tablename` ORDER BY `date` DESC LIMIT 50,50; // fetches rows 51-100

The mistake I constantly make is thinking the second number is the last row I want to fetch, when it fact it is the quantity of rows to select.

And the manual page that talks about LIMIT [dev.mysql.com], for reference.