GregL83 Posted February 17, 2010 Share Posted February 17, 2010 I am trying to rollback more than one insert statment inside a transaction. I thought everything was working fine; however, i'm not sure if its my new hosting. Only the first query of the set seem to rollback. Here is an example: mysql_query("BEGIN"); $result = array(); $result = mysql_query($insert_1); $result = mysql_query($insert_2); $result = mysql_query($insert_3); $result = mysql_query($insert_4); if(!in_array(null, $result)){ mysql_query("COMMIT"); } else{ mysql_query("ROLLBACK"); } Basically, only insert_1 gets rolled back. I thought on my old server the whole set rolled back, but I can't be 100% sure. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/192354-mysql-transaction-rollback-with-multiple-queries/ Share on other sites More sharing options...
GregL83 Posted February 18, 2010 Author Share Posted February 18, 2010 I solved the problem... after digging a little deeper i noticed that the tables i wanted to perform transactions on were setup in the MyISAM engine. Once setup in InnoDB everything worked out as expected. Link to comment https://forums.phpfreaks.com/topic/192354-mysql-transaction-rollback-with-multiple-queries/#findComment-1014122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.