<?php//transaction control, rollback//Create a Mysqli object $mysqli = new mysqli ("hostname", "MySQL User name", "Password", "database Name");//Determine if the link succeeds if ($mysqli Connect_error) {die ($mysqli->connect_error);} Due to the system default commit in the transaction commit, it is set to false first not commit $mysqli->autocommit (false);//Actually here the system is quite here to make a savepoint, record all the state at this time, rollback is rollback to here//$mysqli- >savepoint a;//writes the operation statement to the database $SQL1 = "INSERT into table name (field name) values (corresponding field value)"; $sql 2 = "Update table name set field name = value where Condition"; $sql 3 = Delete from table name where condition;//Execute SQL statement $res1 = $mysqli->query ($sql 1) or Die ($mysqli->error); $res 2 = $mysqli->query ( $sql 2) or Die ($mysqli->error), $res 3 = $mysqli->query ($sql 3) or Die ($mysqli->error);//Determine if all success is performed if (! $res 1| |! $res 2| |! $res 3) {//As long as there is a failure to rollback, do not execute, if you set the rollback point, such as a, add a parameter A to roll back to a where $mysqli->rollback ();} else{//once the commit cannot be rolled back, the $mysqli->commit () is submitted successfully;} Close resource $musqli->close ();? >