title: In PHP, can I get MySQL to rollback a transaction if I disconnect without committing, rather than commit it?
body: <p>If I run the following PHP, I would expect no value to be inserted into the test table, because I have a transaction that I haven't committed:</p>
  <pre><code>$db = mysql_connect(&quot;localhost&quot;,&quot;test&quot;,&quot;test&quot;);
  mysql_select_db(&quot;test&quot;);
  mysql_query(&quot;begin transaction;&quot;);
  mysql_query(&quot;insert into Test values (1);&quot;) or die(&quot;insert error: &quot;. mysql_errror());
  die('Data should not be commited\n');
  mysql_query(&quot;commit;&quot;); // never occurs because of the die()
  </code></pre>
  <p>But instead it seems to commit anyway. Is there a way to turn off this behaviour without turning off autocommit for the PHP that doesn't use transactions elsewhere on the site?</p>