Home > Backend Development > PHP Tutorial > PHP pdo transaction rollback code example_PHP tutorial

PHP pdo transaction rollback code example_PHP tutorial

WBOY
Release: 2016-07-13 17:04:27
Original
1474 people have browsed it

PHP pdo transaction rollback code example
$this->beginTransaction();
$this->exec('update people set age=2');

//$step1 = mysql tutorial_error();//In your class, change it to if there is an error in executing sql, get the error code, and the corresponding function

$this->exec('INSERT INTO course (course,num) VALUES ("Mathematics",100)');

//$step2 = mysql_error();


if (!$step1 && !$step2)
{
$this->commit();
}
else
{
$this->rollBack();
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630862.htmlTechArticlePHP pdo transaction rollback code example $this-beginTransaction(); $this-exec('update people set age =2'); //$step1 = mysql tutorial_error();//In your class, change it to if there is an error in executing sql, get...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template