Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Location
    New Orleans
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do I make a query span several pages

    Instaed of presenting the query results all at once I would like the query to span at least ten pages.

    How do I do this using PHP and mySQl.

    thanks

  • #2
    New Coder
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You do this by using a LIMIT clause at the end of your query:

    eg:

    SELECT * tableName
    WHERE foo='foo'
    ORDER BY foo
    LIMIT 0,10

    That will give you the first ten results (sorted by column foo by alphabetical order)

    SELECT * tableName
    WHERE foo='foo'
    ORDER BY foo
    LIMIT 10, 10

    That will give you the next ten results - starting at an offset of 10 (ie, starting at the 11th record).

    SELECT * tableName
    WHERE foo='foo'
    ORDER BY foo
    LIMIT 20, 10

    The next ten records (21-30)

    etc. So you can hold the offset and number values in a variable in your php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •