#1
  1. No Profile Picture
    Brooks
    Guest
    Devshed Newbie (0 - 499 posts)

    I have my script limiting the number of records returned from a search to 10...

    then I provide a link to another php page adding 10 to the offset to return the next 10 records...

    however, the next 10 records that are being returned are not of the same query that the person searched for... the 10 records that are returned are starting from the 10th record in the entire dataset...

    any ideas on how to bring up the next 10 records from what was already searched for?


    thanks

    Brooks
  2. #2
  3. No Profile Picture
    scollo
    Guest
    Devshed Newbie (0 - 499 posts)
    What DBMS are you using?

    Could we see your SQL statement?

    If you're using MySQL (which most people on this BBS seem to), you should probably be using the MySQL LIMIT function; but it also depends on the rest of the SELECT statement being set up correctly.

    Limit:
    http://www.mysql.com/Manual_chapter/manual_Reference.html#SELECT

    First ten:
    SELECT * FROM Monsters WHERE Nocturnal='yes' ORDER BY Weight LIMIT 0, 10;

    Next ten:
    SELECT * FROM Monsters WHERE Nocturnal='yes' ORDER BY Weight LIMIT 10, 10;

    Whatever database you're using, you should use the SQL to limit the results, not PHP code.

    -- Christopher

IMN logo majestic logo threadwatch logo seochat tools logo