title: MySQLi bind_param returning only one row
body: <p>Despite coming from a programming background, I'm still relatively new to PHP and trying to grasp it properly. I have decided to use MySQLi instead of PDO (which turned out to be a grave mistake on my part) for my database needs, but I've run into an issue where bind_result only seems to return one result, despite the results, to my knowledge, being looped through. I've been googling for hours, but I just can't figure out what's going on. I'm sure the solution is very simple, I'm overlooking something, and/or am doing something terribly wrong. If so, I hope you can find it in your heart to forgive me and help me solve my pesky issue, Stack Overflow.</p>
  
  <p><a href="http://privatepaste.com/81a53b01ea/poadslcaw" rel="nofollow">Here is the ever-so-malicious code.</a></p>
  
  <pre><code>public function query($query, $types, $params)
  {
      if ($stmt = $this-&gt;prepareQuery($query, $types, $params))
      {
          $stmt-&gt;execute();
  
          // we prepare the array in which the results will be stored for dynamic results
          $meta = $stmt-&gt;result_metadata();
          $results = array();
          while ($field = $meta-&gt;fetch_field())
          {
              $name = $field-&gt;name;
              $$name = null;
              // pass reference because bind_result() requires it
              $results[$name] = &amp;$$name;
          }
  
          while ($stmt-&gt;fetch())
          {
              // call_user_func_array is used for dynamic results
              call_user_func_array(array($stmt, "bind_result"), $results);
  
              var_dump($results) . "&lt;br /&gt;";
          }
  
          $data = array();
          while ($stmt-&gt;fetch()) {
              array_push($data, $results);
          }
          return $data;
      }
      else
      {
          echo $this-&gt;db-&gt;error;
      }
  }
  </code></pre>