title: Multiple queries dependent on each other
body: <p>I have two queries both dependent on each other, i.e. if first query is not executed the second shouldn't be executed, and the other way around if second can't be executed the first shouldn't be executed.  </p>
  
  <pre><code>INSERT INTO `table` VALUES (1,2,3)
  UPDATE `otherTable` SET `val1`=1 WHERE `id`=$idOfInsert
  </code></pre>
  
  <p><code>ON DUPLICATE KEY UPDATE</code> is not the answer.</p>
  
  <p>I tried using <code>mysqli::multi_query</code> but as it turned out it executes the first even though the second can't be executed (it stops on error). </p>
  
  <p>How can I achieve this in PHP?</p>