title: Determine if UPDATE or INSERT when using ON DUPLICATE KEY
body: <p>I'm using a mysqli/php query that looks like this:</p>
  
  <pre><code>$query = "
  INSERT INTO table (unique_key, column_1, column_2) 
  VALUES (?,?,?)
  ON DUPLICATE KEY UPDATE
  value_1 = ?, value_2 = ?";
  if ($statement = $mysqli-&gt;prepare($query))
  {
      $statement-&gt;bind_param("iiiii", $unique_key, $value_1, $value_2, $value_1, $value_2);
      $statement-&gt;execute();
      $statement-&gt;close();
  }
  </code></pre>
  
  <p>How do I tell if the query executed an UPDATE or an INSERT?</p>