I'm making a simple mysql transaction (yes, using a innodb table), which gets committed. This works as expected, my two mysql queries inside the transaction were successfully executed. Just beneath that, I'm running a non-transactional mysql query (similar to the one above), which doesn't give me any error. "Foo" gets printed to the screen (so the script never died). Now what's weird, is that the value 333 didn't get inserted into the database. And I don't know why, everything seems fine, I'm going nuts, heh! Any query beneath the commit just doesn't seem to work. Your help is appreciated, thanks! (On a sidenote, this code does not represent a good way of making mysql transactions in php, it's just for testing purposes) <?php mysql_connect("localhost", "test", "test") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); mysql_query("SET AUTOCOMMIT=0") or die(mysql_error()); mysql_query("START TRANSACTION") or die(mysql_error()); mysql_query("INSERT INTO crawl_ticket(box) VALUES('82')") or die(mysql_error()); mysql_query("UPDATE crawl_ticket SET box = '72' WHERE box = '82'") or die(mysql_error()); mysql_query("COMMIT") or die(mysql_error()); mysql_query("INSERT INTO crawl_ticket(box) VALUES('333')") or die(mysql_error()); echo 'foo'; ?> PHP:
mysql_query("SET AUTOCOMMIT=0") or die(mysql_error()); You never set AUTOCOMMIT back, so the last insert " crawl_ticket(box) VALUES('333') " would never be inserted. If you started a new connection you would be fine however, since your connection was never destroyed, AUTOCOMMIT would not revert. Also, you may want to switch to mysql improved extension. It handles transactions in much better.