title: Mysql Fetch Array Foreach
body: <p>I am trying to use a foreach loop to set value to populate a table, for some reason my array is showing null inside values. But when I var dump the  $result_list[]  it shows the array of products, Am i doing this wrong?  Thanks</p>
  
  <pre><code>$result = mysql_query("SELECT id, product, price FROM products");
  
  
  $result_list = array();
  while($row = mysql_fetch_array($result)) {
     $result_list[] = $row;
  }
  
  foreach($result_list as $row) {
  
      $productitems[] = array(
          'id' =&gt; $row-&gt;id,
          'product'  =&gt; $row-&gt;product,
          'price'  =&gt; $row-&gt;price
      );              
  }
  
  var_dump($productitems);
  
  
  array(2) { [0]=&gt; array(3) { ["id"]=&gt; NULL ["product"]=&gt; NULL ["price"]=&gt; NULL } [1]=&gt; array(3) { ["id"]=&gt; NULL ["product"]=&gt; NULL ["price"]=&gt; NULL } } 
  </code></pre>