September 13th, 1999, 02:19 PM
I wish to use mySQL to display data n records at a time similar to the way it is done on search engines. Once I display the 1st n records, I want to be able to provide a link to the 2nd n records. Right now, the only way I know to do this is to execute the query grabbing all records and to use a while or for loop to only grab the 2nd set of n records. Is there a smarter, less memory-intensive way to do this.
T e c h 9 M u l t i m e d i a
September 13th, 1999, 02:50 PM
you can use a LIMIT offset, rows with your select statement. i use this all of the time and it works great. All you need to do is keep track of the last offset. The rows variable is the number you return and presumably that will stay the same.
SELECT * from table_name LIMIT 0,12;
SELECT * from table_name LIMIT 12,12;