title: MySQL tb_uq Duplicate Row without Fatal Error Output
body: <pre><code>ALTER TABLE purchase ADD CONSTRAINT tb_uq UNIQUE (item_id, user_id)
  
  INSERT INTO purchase (item_id, user_id, time) VALUES (:item_id, :user_id, :time)
  </code></pre>
  
  <p>I have a table <code>item_id</code>, <code>user_id</code>, <code>time</code></p>
  
  <p><code>item_id</code> &amp; <code>user_id</code> will be unique(User can only purchase item once)</p>
  
  <p>if user click button and load this SQL again, it will cause <code>Fatal Error</code> because row already exist.</p>
  
  <p>My question is I don't want to use extra query to <code>count(*)</code> before <code>INSERT</code> so is there anyway to just ignore it and avoid <code>Fatal Error</code> without extra query?</p>