Skip to content

Instantly share code, notes, and snippets.

@timgavin
Created April 22, 2015 12:24
Show Gist options
  • Save timgavin/943b3f193ca185a068c1 to your computer and use it in GitHub Desktop.
Save timgavin/943b3f193ca185a068c1 to your computer and use it in GitHub Desktop.
ezSQL Transaction (MySQLi)
// 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