Transactions are a common operation in SQL
. PHP
also needs to connect to the database, so it needs to be compatible with some operations of SQL
. In PDO Among the
connection methods, PHP
provides the use of the commit()
function. This article will take you to take a look.
First let’s take a look at the syntax of the commit()
function in PDO
1 |
|
Return value: on success Return true, or return false on failure
Code example:
1. Submit a basic transaction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
2. Submit DLL transaction
1 2 3 4 5 6 7 8 9 10 11 |
|
Recommendation:《2021 PHP Summary of interview questions (collection)》《php video tutorial》
The above is the detailed content of In-depth analysis of PDO::commit() in PHP. For more information, please follow other related articles on the PHP Chinese website!