title: How to insert a row, but on duplicate; update it instead?
body: <p>I have a table which contains the items the users of my game owns. If a user buys a new item, it should be inserted, but if he already got it, it should be increased instead. </p>
  
  <p>I understand I can use <code>INSERT ... ON DUPLICATE KEY UPDATE</code>, but I don't understand how in my problem.</p>
  
  <p>The <code>item_id</code> isn't unique, because many players can own the same weapon (ie. a longsword). The <code>user_id</code> isn't unique either, because a player can own many items.</p>
  
  <p>So, my question is how to make the query <code>UPDATE</code> instead of <code>INSERT</code> if a row containing both the <code>user_id</code> and <code>item_id</code> already exists?</p>