title: Update a record with PDO using parameters
body: <p>I'm trying to update my database table with PDO, but to avoid security leaks, I'm using parameters in my query.</p>
  
  <p>I'm getting this error:<br>
  <code>exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in D:\xampp\htdocs\logansarchive\admin\do.article.php:25 Stack trace: #0 D:\xampp\htdocs\logansarchive\admin\do.article.php(25): PDOStatement-&gt;execute() #1 {main}</code></p>
  
  <p>Here's my code:</p>
  
  <pre><code>$sql = "update articles set".
      "category = :cat,".
      "articletitle = :title,".
      "articlecontent = :content".
      "where articleid = :target";
  
  $result = $dbh-&gt;prepare($sql);
  $result-&gt;bindParam(":cat", $category);
  $result-&gt;bindParam(":title", $title);
  $result-&gt;bindParam(":content", $content);
  $result-&gt;bindParam(":target", $target);
  $result-&gt;execute();
  </code></pre>
  
  <p>I found this <a href="https://stackoverflow.com/questions/6829324/not-able-to-update-rows-using-pdo">Not able to update rows using PDO</a>
  which looks fairly similar to what I'm doing, but I'm not sure how to fix my code based on this as I can't see any of the problems listed there by the guy who answered that question.</p>
  
  <p>Any help will be greatly appreciated.</p>
  
  <p>Thanks for your time!</p>