title: Using ON DUPLICATE KEY UPDATE in PDO
body: <p>How can I use <code>ON DUPLICATE KEY UPDATE</code> in PDO</p>
  
  <p>My problem is that I get  (SQLSTATE[42000]: Syntax error or access violation?) when I try the following synthaxe, the insert function and update works fine, but when I use both with on duplicate, I get error :</p>
  
  <pre><code>    $query = "INSERT INTO my_table (name,tophtml,bothtml,lang,background_mode,redirhtml,bg_color)
                VALUES (:name, :top_html, :bottom_html, :hs_language, :bg_style, :redirect_to, :bg_color )
                ON DUPLICATE KEY UPDATE
                tophtml= :top_html, bothtml= :bottom_html, lang= :hs_language, bg_color= :bg_color, redirhtml= :redirect_to, background_mode= :bg_style WHERE name=:name
               ";
      $request = $databaseStatus-&gt;connection-&gt;prepare($query);
      $request-&gt;bindParam(":name", $name, PDO::PARAM_STR);
      $request-&gt;bindParam(":top_html", $top_html, PDO::PARAM_STR);
      $request-&gt;bindParam(":bottom_html", $bottom_html, PDO::PARAM_STR);
      $request-&gt;bindParam(":bg_color", $bg_color, PDO::PARAM_STR);
      $request-&gt;bindParam(":redirect_to", $redirect_to, PDO::PARAM_STR);
      $request-&gt;bindParam(":hs_language", $hs_language, PDO::PARAM_STR);
      $request-&gt;bindParam(":bg_style", $bg_style, PDO::PARAM_STR);
      $request-&gt;execute();
  </code></pre>