title: PHP foreach loop unexpected behaviour
body: <p>What I am trying to do here is write a code to update my database automatically; for those derived attributes. Here is the part of the code where I try to grab all the rows in an array:</p>
  
  <pre><code>include("dbConnect.php");
  $results = $mysqli-&gt;query("SELECT * from nw_order;");
  if($results) 
      foreach($results as $hgh)
          $resultArray[] = $results-&gt;fetch_row();
  
  else
      die("Query failed");
  
  foreach($resultArray as $row) {
      foreach($row as $field)
          print $field." ";
      print "&lt;br&gt;";
  }
  </code></pre>
  
  <p>The foreach grab only even numbered rows for some reason.
  Also, trying to substitute foreach with while gives me memory shortage error. I am so tired I will check in tomorrow. If you can help me out that will be awesome.</p>