title: sql query PDO bindParam
body: <p>I was trying to insert email and email password to a table where it already contains the username and password. the query i am using : </p>
  
  <pre><code>&lt;?php
  
      session_start();
      include 'config.php';   
      $username = $_SESSION['username'];
      $uname = $_POST['email'];
      $pass = $_POST['passne'];
  
      $sql = "INSERT INTO users(email, emailpassword) VALUES (:uname, :pass) WHERE username = :username";
      $query = $conn-&gt;prepare($sql);
      $query-&gt;bindParam(':uname', $uname, PDO::PARAM_STR);
      $query-&gt;bindParam(':pass', $pass, PDO::PARAM_STR);
      $query-&gt;bindParam(':username', $username, PDO::PARAM_STR);
      $query-&gt;execute();
      echo "Success";
  ?&gt;
  </code></pre>
  
  <p>but it shows this error</p>
  
  <p><strong>Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE username = 'thansiya123'' at line 1 in C:\xampp\htdocs\b\update.php:14 Stack trace: #0 C:\xampp\htdocs\b\update.php(14): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\b\update.php on line 14</strong></p>