title: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in PHP
body: <p>I am trying to do a username search [which I seemingly finished and working as well] but when you've searched for the username, the information about the account will show up. For example, I've searched for <em>virtualAnon</em>, his name and information such as <em>first_name</em> will show up after his username.</p>
  <p>I've tried to fix it by replacing <code>$query = &quot;SELECT username FROM users WHERE username like ? LIMIT 1&quot;;</code> to <code>$query = &quot;SELECT * FROM users WHERE username like ? LIMIT 1&quot;;</code> but after I've tried that, the error</p>
  <blockquote>
  <p>mysqli_stmt::bind_result(): Number of bind variables doesn't match
  number of fields in prepared statement in PHP</p>
  </blockquote>
  <p>shows up.</p>
  <p><strong>This is the PHP file to fetch usernames and database: <br></strong></p>
  <pre><code>&lt;?php
      if($_GET['keyword'] &amp;&amp; !empty($_GET['keyword']))
      {
          $conn = mysqli_connect('localhost','root','','loginsecure'); //Connection to my database
          $keyword = $_GET['keyword'];
          $search = $_GET['keyword'];
          $keyword=&quot;%$keyword%&quot;;
          $query = &quot;SELECT * FROM users WHERE username like ? LIMIT 1&quot;;
          # When I tried to SELECT *, It gives me the error of: Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in ...\fetch.php on line 22
          $statement = $conn-&gt;prepare($query);
          $statement-&gt;bind_param('s',$keyword);
          $statement-&gt;execute();
          $statement-&gt;store_result();
          if($statement-&gt;num_rows() == 0) // so if we have 0 records acc. to keyword display no records found
          {
              echo '&lt;div id=&quot;item&quot;&gt;Sorry, but there is no user &quot;'.$search.'&quot; found in our database :(&lt;/div&gt;';
              $statement-&gt;close();
              $conn-&gt;close();
  
          }
          else {
              $statement-&gt;bind_result($name); # There is a error i'm encountering when I try to Select * from the line 8.
              while ($statement-&gt;fetch()) //outputs the records
              {
                  echo &quot;&lt;div id='item'&gt;&lt;a href=\&quot;../user/username.php?username=$name\&quot;&gt;$name&lt;/a&gt;&lt;/div&gt;&quot;;
                  # It supposed to show more information about the user, by using $name['first_name'] or $name['last_name']
              };
              $statement-&gt;close();
              $conn-&gt;close();
          };
      };
  ?&gt;
  </code></pre>