Transakcja PDO
<?php
/* Begin a transaction, turning off autocommit */
$dbh->beginTransaction();
try {
/* Change the database schema and data */
$sth = $dbh->exec("DROP TABLE fruit");
$sth = $dbh->exec("UPDATE dessert
SET name = 'hamburger'");
}
catch(Exception $e){
/* Recognize mistake and roll back changes */
$dbh->rollBack();
}
/* Commit changes */
$dbh->commit();
Beautiful Bug