I am trying to execute a series of different queries. Simply put, I need them all to execute successfully, or I need to have none of them execute.
At the moment, I do
mysql_query("SET autocommit=0;");
mysql_query("BEGIN;");
mysql_query("QUERY A");
if(mysql_error()){
mysql_query("rollback;");
die();
}
mysql_query("QUERY B");
if(mysql_error()){
mysql_query("rollback;");
die();
}else{
mysql_query("commit;");
}
The problem is that if I force query B to fail, I can still see the results of query A when looking at the database in phpmyadmin. Surely the query result should not be added to the database?