PHP PDO transaction Rollback code Instance _php Tutorial

Source: Internet
Author: User
PHP PDO transaction Rollback code instance
$this->begintransaction ();
$this->exec (' Update people set age=2 ');

$step 1 = mysql tutorial _error ();//Your class, change to execute SQL error, get error code, corresponding function

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

$step 2 = mysql_error ();


if (! $step 1 &&! $step 2)
{
$this->commit ();
}
Else
{
$this->rollback ();
}

http://www.bkjia.com/PHPjc/630862.html www.bkjia.com true http://www.bkjia.com/PHPjc/630862.html techarticle PHP PDO transaction rollback code instance $this-begintransaction (); $this-exec (' Update people set age=2 ');//$step 1 = mysql tutorial _error ();//Your class, If you execute a SQL error, get ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.