Ezqlphp newbie transaction how to capture operation database errors multiple statements operation database all successful execution before committing the transaction otherwise rollback for example insert a successful execution update statement execution no error, but the update affects the record to 0. do not roll back the following records. $ uname is the same as the uname value in the database $ res, and 0 transaction failures will be returned $ db-& gt; query (& quot; BEGIN & quot;); $ SQL & quot; updatemembersetuname $ unamewhereid $ id & quot; $ res $ db php transaction
New to ezql php
An error occurred while capturing and operating the database for transactions.
Transactions are committed only when multiple statements are successfully executed in the database. Otherwise, the transaction is rolled back.
For example, the insert statement is successfully executed.
The update statement is executed correctly, but the update affects 0 records. do not roll back at this time.
As shown below, the $ uname value is the same as the uname value in the database
$ Res returns 0 transaction failures
$ Db-> query ("BEGIN"); $ SQL = "update member set uname = $ uname where id = $ id "; $ res = $ db-> query ($ SQL); if ($ res) {$ db-> query ("COMMIT"); errAlert ("successful", "list. php ");} else {$ db-> query (" ROLLBACK "); errAlert (" failed, error ", $ theUrl );} $ db-> query ("END ");