title: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]
body: <p>I'm developing a search but there was an error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'       
  in /home/a5350289/public_html/busca.php:26 Stack trace: #0 /home/a5350289/public_html/busca.php(26): PDOStatement-&gt;execute() #1 {main} thrown in /home/a5350289/public_html/busca.php on line 26
  </code></pre>
  
  <p>My code is:
      
  
  <pre><code>if($_GET['s']&lt;&gt;''){
  
      $explode = explode(' ',$_GET['s']);
      $num = count($explode);
  
      for($i=0;$i&lt;$num;$i++){
          $busca .= " `nome` LIKE :$busca$i  OR `district` LIKE :$busca$i OR `city` LIKE :$busca$i OR `area` LIKE :$busca$i ";
  
          if($i&lt;&gt;$num-1){ $busca .= ' AND '; }
  
          }
  
          $buscar = DB::getConn()-&gt;prepare("SELECT * FROM `users` WHERE $busca");
  
          for($i=0;$i&lt;$num;$i++){
              $buscar-&gt;bindValue(":busca$i",'%'.$explode[$i].'%',PDO::PARAM_STR);
          }
  
          $buscar-&gt;execute();
  
      }
                  if($buscar-&gt;rowCount()&gt;0){
                      echo '&lt;ul id="resbusca"&gt;';
                      while($resbusca=$buscar-&gt;fetch(PDO::FETCH_ASSOC)){
  
          echo '&lt;li&gt;&lt;span&gt;&lt;img src="uploads/usuarios/'.$resbusca['foto'].'" /&gt;&lt;/span&gt;
          &lt;h2&gt;&lt;a href="perfil.php?uid='.$resbusca['id'].'"&gt;'.$resbusca['nome'].'&lt;/a&gt;&lt;/h2&gt;
          &lt;p&gt;'.$resbusca['area'].'. '.$resbusca['street'].', '.$resbusca['number'].'.'.$resbusca['district'].' - '.$resbusca['city'].' / '.$resbusca['state'].'&lt;/p&gt;
          &lt;/li&gt;';
  
  
                      }
                      echo '&lt;/ul&gt;';
                  }else{
                  echo '&lt;div align="center" style="margin-top:200px"&gt;&lt;h1&gt;Sem resultados&lt;/h1&gt;&lt;/div&gt;';
  
              }
  
          ?&gt;
  </code></pre>