title: Using PDO with INSERT (PHP)
body: <p>I've got</p>
  
  <pre><code>$sql = $db-&gt;prepare("INSERT INTO `aliases` (`alias`, `domain`, `added`, `enabled`) VALUES (:alias, :domain, :added, :enabled)");
  $sql-&gt;bindValue(':alias', $alias);
  $sql-&gt;bindValue(':domain', $domain);
  $sql-&gt;bindValue(':added', time());
  $sql-&gt;bindValue(':enabled', 1);
  $sql-&gt;execute();
  //how do I test if it was added or #1062 - Duplicate entry '...' for key 'alias'
  </code></pre>
  
  <p>I assume that's correct.</p>
  
  <p>My question is:
  How do I test if it was added successfully?</p>