ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:committrans

commitTrans

Syntax
bool commitTrans(
  optional bool $ok = true
  )

Descriptions

The function commitTrans() commits a granular transaction. This function is not part of the smart transaction set, you must verify that all transactional statements within the transaction scope have completed correctly.

Set parameter $ok to true to commit, false to rollback the transaction.

Return bool true if successful.


Usage

$conn->beginTrans();
 
$ok = $conn->execute($sql);
 
if ($ok) {
    $ok = $conn->execute($sql2);
}
 
if (!$ok) {
    $conn->rollbackTrans();
} else {
    $conn->commitTrans();
}
v5/reference/connection/committrans.txt · Last modified: 2021/04/26 14:02 by peterdd