title: Can i get the `insert_id` (actually just the `id`) when inserting with `ON DUPLICATE KEY`?
body: <p>I am using <code>MySQLi</code> in PHP, and as it turns out, when performing a <code>INSERT</code> query (via <code>MySQLi::query()</code>) with a <code>ON DUPLICATE KEY UPDATE</code> syntax, the <code>insert_id</code> property on the <code>MySQLi</code> object does not get updated with the <code>ID</code> of the entity if you try to insert something that violates the <code>UNIQUE</code> index on the database. </p>
  
  <p>I would really like to avoid a second query, but i haven't been able to find in the documentation if there is any alternative way to reach the ID of the entity whose <code>UNIQUE</code> index has been broken (which is essentially the entity i am trying to insert, so i want to be able to tie it to that ID)?</p>
  
  <p>Just to clarify, i am aware i can get the <code>id</code> if i want to, with a second (<code>SELECT</code>) query, but i am wondering if there is some metadata on the MySQLi object that would allow me to get the <code>id</code> of the entity in question, without doing a second query?</p>