ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:transactions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
v5:userguide:transactions [2018/07/01 23:02] – prefer functions start lowercase (#430) peterddv5:userguide:transactions [2020/08/26 10:09] (current) – [Usage] Add braces as suggested by @peterdd in #629 dregad
Line 46: Line 46:
 $ok = $conn->execute($sql); $ok = $conn->execute($sql);
  
-if ($ok)+if ($ok) {
    /*    /*
    * The previous execution succeeded, do some more    * The previous execution succeeded, do some more
    */     */ 
    $ok = $conn->execute($sql2);    $ok = $conn->execute($sql2);
-else+else {
    /*    /*
    * Branch, do some other work, then return    * Branch, do some other work, then return
    */    */
-if (!$ok) +
 + 
 +if (!$ok) {
     /*     /*
     * Test the last insertion, if not successful roll      * Test the last insertion, if not successful roll 
Line 61: Line 63:
     */     */
     $conn->rollbackTrans();     $conn->rollbackTrans();
-else+else {
     /*     /*
     * Go ahead and commit     * Go ahead and commit
     */      */ 
     $conn->commitTrans();     $conn->commitTrans();
 +}
 </code> </code>
 ----------------------------- -----------------------------
v5/userguide/transactions.1530478975.txt.gz · Last modified: 2018/07/01 23:02 by peterdd