title: Copy table structure and data into 2D array
body: <p>Here I have a MySQL database and I need to retrieve many rows.</p>
  
  <p>I need the data to stack up in one array:</p>
  
  <pre><code>$query_sel_node  = "SELECT * FROM $table_name";                 
  $result_data = mysql_query($query_sel_node);
  
  $data_rec = array("data" =&gt; array(), "data_h" =&gt; array(), "file" =&gt; array(), "ptr" =&gt; array(), "name" =&gt; array());
  while($data_fetched = mysql_fetch_assoc($result_data))
                  {   
                      array_push($data_rec["data_h"], $data_fetched['data_h']);
                      array_push($data_rec["data"], $data_fetched['data']);
                      array_push($data_rec["file"], $data_fetched['m_file_thumb']);
                      array_push($data_rec["ptr"], $data_fetched['m_pointer']);
                      array_push($data_rec["name"], $data_fetched['m_name']);
                  }
  </code></pre>
  
  <p>now, i've added alot of columns to my table , which means i would need to array_push() for every single column i made. </p>
  
  <p>is there a easier way that i can do this with fewer lines of code?</p>
  
  <p>what i'm looking for is this:</p>
  
  <p>i have a mysql table with column {m_data, m_name, m_file}
  and i have several rows of data</p>
  
  <p>now i need to get them into array</p>
  
  <p>my array will use the column names an the key,
  then i'll store my row data into each key</p>