$db = new PDO($dsn,$user,$password);
$db->beginTransaction();
try{
//first execution
$db->exec("delete from mytable");
//second execution
$db->exec("insert into anothertable");
//if all went well
$db->commit();
} catch (Exception $e) {
//something broke, hit undo
$db->rollBack();
}
.
No hay comentarios:
Publicar un comentario