title: Can not figure out why mysqli_num_rows is not working on my query
body: <pre><code>function userexists($username){
      $query=$mysqli-&gt;query("SELECT username FROM accounts WHERE username='$username' AND exists=1");
      return mysqli_num_rows($query);
  }
  </code></pre>
  
  <p>This function should be returning 1 or 0 but I can not figure out why the query is not being interpreted. What's wrong?</p>
  
  <p>Edit: the error being returned by php is that $query is a boolean being fed into mysqli_num_rows, not an object.</p>