if ($dbh->beginTransaction())
{
try
{
//your db code
$dbh->commit();
}
catch (Exception $ex)
{
if ($dbh->inTransaction())
{
$dbh->rollBack();
}
}
}
Reference:
https://stackoverflow.com/questions/24408434/pdo-transaction-syntax-with-try-catch
No comments:
Post a Comment