note 121230 added to mysqli.rollback
| From: | contact at guillaume-gueyraud dot fr | Date: | Thu, 15 Jun 2017 12:35:09 +0000 |
| Subject: | note 121230 added to mysqli.rollback | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209134@lists.php.net to get a copy of this message | ||
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();
----
Server IP: 72.52.91.14
Probable Submitter: 31.35.218.18
----
Manual Page -- http://php.net/manual/en/mysqli.rollback.php
Edit -- https://master.php.net/note/edit/121230
Del: integrated -- https://master.php.net/note/delete/121230/integrated
Del: useless -- https://master.php.net/note/delete/121230/useless
Del: bad code -- https://master.php.net/note/delete/121230/bad+code
Del: spam -- https://master.php.net/note/delete/121230/spam
Del: non-english -- https://master.php.net/note/delete/121230/non-english
Del: in docs -- https://master.php.net/note/delete/121230/in+docs
Del: other reasons-- https://master.php.net/note/delete/121230
Reject -- https://master.php.net/note/reject/121230
Search -- https://master.php.net/manage/user-notes.php