title: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement
body: <p>I’ve been trying to code a login form in PHP using a prepared statement but every time I try to log in I get the following error:</p>
  <blockquote>
  <p>mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement</p>
  </blockquote>
  <p>Here is my code:</p>
  <pre><code>&lt;?php
  
  $mysqli = new mysqli(&quot;localhost&quot;, &quot;root&quot; , &quot;&quot; , &quot;security&quot;);
  
  $stmt = $mysqli-&gt;prepare(&quot;SELECT username AND password FROM users WHERE username = ?&quot;);
  $username = $_POST['name'];
  $stmt-&gt;bind_param('s', $username);
  $stmt-&gt;execute();
  $stmt-&gt;bind_result($password, $username);
  $stmt-&gt;fetch();
  </code></pre>
  <p>Can someone tell me why this is happening?</p>