title: Identify duplicate entry for user, MySQL & PHP
body: <p>I have a submission form that returns a MySQL error #1062 when a user tries to submit it with a duplicate entry. As an example, the error states:</p>
  
  <pre><code>Duplicate entry 'graphics' for key 'name'
  </code></pre>
  
  <p>I want to give the user a custom message that explains (in plain English) why they got an error, and what specific entry caused the error. For example:</p>
  
  <pre><code>"Graphics" is a duplicate entry and should not be used. Please remove it and resubmit the form."
  </code></pre>
  
  <p>The key will always be 'name,' but the duplicate entry itself will often be different. I need to be able to pull that specific value out of the MySQL error that's generated, and then wrap my custom message around it. How could this be done?</p>