#1
  1. No Profile Picture
    mjhill
    Guest
    Devshed Newbie (0 - 499 posts)
    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
    www.tech-9.com
    info@tech-9.com
  2. #2
  3. No Profile Picture
    dchrist
    Guest
    Devshed Newbie (0 - 499 posts)
    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.

    ie.
    first time:
    SELECT * from table_name LIMIT 0,12;
    second time:
    SELECT * from table_name LIMIT 12,12;

Similar Threads

  1. Will table size affect data retrival time?
    By abones in forum Oracle Development
    Replies: 1
    Last Post: February 10th, 2004, 08:55 AM
  2. my comp sux lately , need help from pro's
    By Hykinsel007 in forum Windows Help
    Replies: 2
    Last Post: January 5th, 2004, 01:52 PM
  3. need to find the data entered with the most recent time
    By cooperchien in forum MySQL Help
    Replies: 2
    Last Post: September 20th, 2003, 08:29 PM
  4. displaying db records one at a time.
    By nowayman in forum PHP Development
    Replies: 7
    Last Post: August 1st, 2001, 08:03 AM
  5. displaying db records one at a time
    By nowayman in forum MySQL Help
    Replies: 0
    Last Post: July 23rd, 2001, 11:56 AM

IMN logo majestic logo threadwatch logo seochat tools logo