Mysql-design of PHP database commit transaction mode

Source: Internet
Author: User
Tags php database
I am not personally familiar with transactions, but in fact, transactions are an important part of a project. I would like to discuss with you the transaction model, we can learn more about transaction processing methods based on this discussion. Take Mysql as an example: to execute a transaction mode, you need to disable MYSQ... I am not personally familiar with transactions, but in fact, transactions are an important part of a project. I would like to discuss with you the transaction model, we can learn more about transaction processing methods based on this discussion.

Take Mysql as an example:

To execute the transaction mode once, you need to disable the MYSQL automatic commit mode, and then submit the SQL statements in sequence. If all statements pass, success and related processing are returned.

I don't know how people generally design it?
You can go to the Code logic step and scenario application introduction!

Reply content:

I am not personally familiar with transactions, but in fact, transactions are an important part of a project. I would like to discuss with you the transaction model, we can learn more about transaction processing methods based on this discussion.

Take Mysql as an example:

To execute the transaction mode once, you need to disable the MYSQL automatic commit mode, and then submit the SQL statements in sequence. If all statements pass, success and related processing are returned.

I don't know how people generally design it?
You can go to the Code logic step and scenario application introduction!

This is simple. Transaction operations are generally performed on two or more multi-Table operations. If the SQL Execution of one of the tables fails, all SQL statements are executed and abolished, that is to say, when a transaction is rolled back to its original state, the bank's transfer operation must be a transaction. Zhang San will send 100 yuan to Li Si, Zhang San's account-100 yuan, and Li Si's account + 100 yuan, if Michael fails to operate-100, then Michael's + 100 fails. If no things are needed, don't let Michael die, or the bank loses.

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.