title: SQL Error 1064, 42000 You have an error in your SQL syntax but unable to spot the problem
body: <p>SOLVED: One argument wasn't passed to the function. </p>
  
  <hr>
  
  <p>I am trying to update a record in the database using PDO in PHP. 
  When executing the query I receive an error 1604. </p>
  
  <p>[42000,1064,"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 WHERE id = 175' at line 1"]</p>
  
  <p>The query gets executed from a new method in a Class for a API</p>
  
  <pre><code>public function updateRaceTeamOrder($forRace, $position){
  
      $race_set ="";
  
      if ($forRace=="GS") {
          $race_set = "raceGS_position";
      }
      if ($forRace=="SB") {
          $race_set = "raceSB_position";
      }
      if ($forRace=="XC") {
          $race_set = "raceXC_position";
      }
  
      $query = "UPDATE " . $this-&gt;table_name . "SET {$race_set}=:raceTeamPosition WHERE id = :id";
  
       $stmt = $this-&gt;conn-&gt;prepare($query);
  
      // sanitize
  
  
      $this-&gt;id=htmlspecialchars(strip_tags($this-&gt;id));
      $position=htmlspecialchars(strip_tags($position));
  
      if (!is_int($this-&gt;id)) {
          $this-&gt;id = intval($this-&gt;id);
      }
  
      if (!is_int($position)) {
          $position = intval($position);
      }
  
      $stmt-&gt;bindParam(':raceTeamPosition', $position, PDO::PARAM_INT);
      $stmt-&gt;bindParam(':id', $this-&gt;id, PDO::PARAM_INT);
  
      // execute the query
      if($stmt-&gt;execute()){ 
          return true;
      }
  
      return $stmt-&gt;errorInfo();
  </code></pre>