title: MySQL transaction is committed even when error occurred
body: <p>In my project, I delete and update lots of rows across many tables, so I decided to use transaction. But transaction is committed even, when error occurred and script is ending.</p>
  
  <p>I use only <strong>mysql_</strong> not <strong>mysqli_</strong> or <strong>PDO</strong> because on that server it isn't supported.</p>
  
  <pre><code>mysql_query("START TRANSACTION");
  $res = mysql_query("some insert...");
  if($res === false){
    //this save error log and exit script with die() or exit()
    trigger_error(mysql_errno()."\n".mysql_error()); 
  }
  $res = mysql_query("some delete...");
  if($res === false){
    trigger_error(mysql_errno()."\n".mysql_error()); 
  }
  mysql_query("COMMIT");
  </code></pre>
  
  <p>In my project I have for mysql my class so I don't type it like this, but this way it works.</p>
  
  <p>When after first query error happen, error log is saved end script is ended. But inserted data stay in DB. I though, when <code>COMMIT</code> isn't executed and connection is closed, automatically <code>ROLLBACK</code> happen.</p>
  
  <p>P.S. I know, that using mysqli should be better, but this is the same for <strong>mysql_</strong> and <strong>mysqli_</strong>, isn't it?</p>