title: MySQLi stmt num_rows returning 0
body: <p>I'm having an issue with using <code>$stmt-&gt;num_rows</code> in PHP and I'm not sure what I'm doing wrong. <code>$stmt-&gt;num_rows</code> is returning 0 when it should be returning 1. The query <em>does</em> work and returns 1 result when executing it in phpMyAdmin. Any help would be greatly appreciated.</p>
  
  <pre><code>public function get_login($username, $password)
  {
      $query = "SELECT `id` FROM `users` WHERE `username` = ? AND `password` = ? LIMIT 1;";
      if($stmt = $this-&gt;prepare($query))
      {
          $stmt-&gt;bind_param('ss', $username, $password);
          if($stmt-&gt;execute())
          {
              $stmt-&gt;bind_result($id);
              $stmt-&gt;fetch();
              $stmt-&gt;store_result();
              if($stmt-&gt;num_rows &gt; 0)
              {
                  return $id;
              }
              return false;
          }
          return false;
      }
      return false;
  }
  </code></pre>