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 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieve names from MYSQL

    Hi Guyz wud you kindly assist!

    1. Im tryin to retrieve the following names from the database

    'kagiso', 'steve', 'dwele', 'raheem', 'raekwon', 'common'

    2. i need to retrieve only 3 names @ a time
    then echo a 'next >>' link that will retrieve the last three

    ============|===========|============|=======
    Thanx in Advance!

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    you would retrieve all six at once from your database and then use your PHP code to display 3 and then 3 more.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Location
    Preston, Lancashire, England
    Posts
    285
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by guelphdad
    you would retrieve all six at once from your database and then use your PHP code to display 3 and then 3 more.
    Thats ok if there is only 6 names. But if you have 600 names and want to show 30 a page then you are puling a lot of data every time.

    What i would to is use the LIMIT option on the mysql statement.

    So if would be like this.

    Code:
    Select * FROM names LIMIT 0 , 3
    this will select the first three;
    then the second query would be
    Code:
    Select * FROM names LIMIT 3 , 3
    This would select the 4th, 5th and 6th.


  •  

    Posting Permissions

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