SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot jooles's Avatar
    Join Date
    Jun 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP MySQL Easy Arrays?

    How can I get a row of mysql data into a php array without making a loop that takes forever.

    $sql = "SELECT * FROM general_info";
    $res = mysql_query($sql);
    $array = ???

    I currently have a loop that is just way to slow when I have 8000+ rows.

    Thanks.

  2. #2
    SitePoint Zealot musher's Avatar
    Join Date
    Nov 2005
    Location
    Hull, England
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:

    $array 
    mysql_fetch_assoc($res); 

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That'll only read the first row. You need a loop.

    If the amount of data is large, it's going to take some time to transfer it from the database to the application and buffer it into memory.

    Do you really need all 8000+ rows? Really?


Bookmarks

Posting Permissions

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