Created
April 22, 2015 12:24
-
-
Save timgavin/943b3f193ca185a068c1 to your computer and use it in GitHub Desktop.
ezSQL Transaction (MySQLi)
This file contains 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
// begin the transaction | |
$db->query('BEGIN'); | |
// run all of your queries here... | |
// commit the queries | |
if($db->query('COMMIT') !== false) { | |
// transaction was successful | |
} else { | |
// transaction failed, rollback | |
$db->query('ROLLBACK'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment