Answers for "php adodb transaction"

PHP
0

php adodb transaction

/*
* Start transaction scope
*/
$conn->beginTrans();
 
/*
* Execute some insert or update SQL
*/
$ok = $conn->execute($sql);
 
if ($ok) {
   /*
   * The previous execution succeeded, do some more
   */ 
   $ok = $conn->execute($sql2);
} else {
   /*
   * Branch, do some other work, then return
   */
}
 
if (!$ok) {
    /*
    * Test the last insertion, if not successful roll 
    * back the entire transaction scope
    */
    $conn->rollbackTrans();
} else {
    /*
    * Go ahead and commit
    */ 
    $conn->commitTrans();
}
Posted by: Guest on May-08-2021

Browse Popular Code Answers by Language