note 121230 deleted from mysqli.rollback by peehaa

From: Date: Thu, 15 Jun 2017 13:37:08 +0000
Subject: note 121230 deleted from mysqli.rollback by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209135@lists.php.net to get a copy of this message
Note Submitter: contact at guillaume-gueyraud dot fr ---- You need to rollback every query of the transaction. $mysqli->autocommit(false); $mysqli->begin_transaction(); //Your first query $req = $mysqli->prepare('INSERT INTO table (col1, col2) VALUES ("val", "Val2", "test")'); if(!$req->execute()) $mysqli->rollback(); //Your second query $req = $mysqli->prepare('INSERT INTO table (col1, col2) VALUES ("val", "Val2", "test")'); if(!$req->execute()) $mysqli->rollback(); $mysqli->commit();

« previous php.notes (#209135) next »