title: PDO mysql: How to know if insert was successful
body: <p>I'm using PDO to insert a record (mysql and php)</p>
  
  <pre><code>$stmt-&gt;bindParam(':field1', $field1, PDO::PARAM_STR);
  $stmt-&gt;bindParam(':field2', $field2, PDO::PARAM_STR);
  $stmt-&gt;execute();
  </code></pre>
  
  <p>Is there a way to know if it inserted successfully, for example if the record was not inserted because it was a duplicate?</p>
  
  <p>Edit: of course I can look at the database, but I mean programmatic feedback.</p>