How to get all rows in an array

Discussion in 'PHP' started by promotingspace.net, Sep 20, 2009.

  1. #1
    Hi
    I want to get table records all in 1 array. I used mysql_fetch_array() but it was returning the first record only
    How can all records be stored in 1 array?
    I have table: symbols1 and symbols2; I want to get all of their data and then use array_merge() to combine the data
    Thanks for your help
     
    promotingspace.net, Sep 20, 2009 IP
  2. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    #2
    
    
    $query = mysql_query("SELECT ...");
    $q_array = array();
    while($rows = mysql_fetch_array($query)) {
    $q_array[] = $rows;
    }
    
    
    PHP:
    Then you can use $q_array[0]['id] for example.
    (will get the first row's id column)
     
    Oli3L, Sep 20, 2009 IP