Jump to content

MySql Transaction Rollback with multiple queries


GregL83

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.