title: Call to undefined function mysqli_result::num_rows()
body: <p>I'm trying to count the number of rows in a result, and I keep getting the above returned error.  I've checked the manual, and I'm using mysqli_result::num_rows() as I should be (I'm using object oriented style.)  I've got three classes working here.</p>
  
  <p>Class (Connection):</p>
  
  <pre><code>class utils_MysqlImprovedConnection {
      protected $_connection;
  
      public function __construct($host, $user, $pwd, $db)
      {
          $this-&gt;_connection = @new mysqli($host, $user, $pwd, $db);
          if(mysqli_connect_errno ()) {
              throw new RuntimeException('Cannot access database:' . mysqli_connect_error());
          }
      }
  
      public function getResultSet($sql)
      {
          $results = new utils_MysqlImprovedResult($sql, $this-&gt;_connection);
          return $results;
      }
  
      public function  __destruct() {
          $this-&gt;_connection;
      }
  }
  </code></pre>
  
  <p>Class (Handles Result):</p>
  
  <pre><code>class utils_MysqlImprovedResult implements Iterator, Countable {
      protected $_key;
      protected $_current;
      protected $_valid;
      protected $_result;
  
  
      public function  __construct($sql, $connection) {
         if (!$this-&gt;_result = $connection-&gt;query($sql)){
             throw new RuntimeException($connection-&gt;error . '. The actual query submitted was: '. $sql);
         }
      }
  
      public function  rewind()
      {
          if (!is_null($this-&gt;_key)){
              $this-&gt;_result-&gt;data_seek(0);
          }
          $this-&gt;_current = $this-&gt;_result-&gt;fetch_assoc();
          $this-&gt;_valid = is_null($this-&gt;_current) ? false : true;
      }
      public function valid()
      {
          return $this-&gt;_valid;
      }
      public function current()
      {
          return $this-&gt;_current;
      }
      public function key()
      {
          return $this-&gt;_key;
      }
      public function next()
      {
          $this-&gt;_current = $this-&gt;_result-&gt;fetch_assoc();
          $this-&gt;_valid = is_null($this-&gt;_current) ? false : true;
          $this-&gt;_key++;
      }
      public function count()
      {
          $this-&gt;_result-&gt;store_result();
          $this-&gt;_result-&gt;num_rows();
      }
  }
  </code></pre>
  
  <p>Class function:</p>
  
  <pre><code>public function resetPassword($email, $pass){
      //check if email exists, update authkey and password, send email
      $sql = "SELECT * FROM table WHERE column = '$email'";
      $results = $this-&gt;_db-&gt;getResultSet($sql);
      if($results-&gt;count() == 1){
          // Process
          $this-&gt;_message = "Success!";
          return $this-&gt;_message;
      } else {
          // Not unique
          $this-&gt;_error = "Try again";
         return $this-&gt;_error;
      } 
  }
  </code></pre>
  
  <p>The test page I'm using to call all this is (include statement is just __autoload() function that is working fine): </p>
  
  <pre><code>$columnvar = 'emailaddress@test.com';
  $pass = 'blah';
  require_once 'inc.init.php';
  $user = new utils_User();
  try{
     $string = $user-&gt;resetPassword($email, $pass);
     echo $string;
  }
  catch(Exception $e) {
     echo $e;
  }
  </code></pre>