Last active
August 29, 2015 14:05
-
-
Save novasky-zz/772e09e2329be73f9c8d to your computer and use it in GitHub Desktop.
Fixed: Rollback transactions in PHP ADODB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Problem: RollbackTrans() command doesn't work | |
* | |
* FIX: | |
* The problem happens whenever I use the "mysql" driver to connect in the database | |
* To fix it, I used the "mysqli" driver in ADODB Connection | |
* | |
* The next example is the correct use of Transactions in ADODB | |
*/ | |
$DB = &ADONewConnection("mysqli"); | |
$DB->Connect('hostname', 'db_user', 'db_pass', 'db_name'); | |
$DB->BeginTrans(); | |
$DB->Execute(" SQL QUERY "); | |
$DB->Execute(" SQL QUERY "); | |
// Revert all SQL queries: | |
$DB->RollbackTrans(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment