I read about mysql transactions, and I got the impression that you had to use mysqli or PDO to create transactions. However, I see all examples of stack exchanges and other sites that use the mysql extension as follows:
mysql_query("START TRANSACTION");
$rollback=0
if (!mysql_query($query1)){
$rollback=1
}
if (!mysql_query($query2)){
$rollback=1
}
if (!mysql_query($query3)){
$rollback=1
}
if ($rollback == 1){
mysql_query("ROLLBACK");
}
else{
mysql_query("COMMIT");
}
What is the difference between executing this method and using special mysqli functions mysqli :: rollback and mysqli :: commit?
In addition, what happens if the php script crashes (IE server crash of my application, etc.), the database server automatically rolls back from the transaction after the set time interval?
, , mysql_query ( "COMMIT" )? ""?
!