note 44945 deleted from function.odbc-autocommit by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 20 Aug 2004 21:25:21 +0000 |
| Subject: | note 44945 deleted from function.odbc-autocommit by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75028@lists.php.net to get a copy of this message | ||
Note Submitter: rlegend2 at pacbell dot net
----
Making Database workspace via autocommit:
<?php
$conn = odbc_connect("connection stuff here");
odbc_autocommit($conn,FALSE); // disables autocommit
$sql = "some sql";
$sql2 = "some sql";
$ErrorCount = 0;
// on execution failure $ErrorCount will increment
odbc_exec($conn,$sql) or $ErrorCount++;
odbc_exec($conn,$sql2) or $ErrorCount++;
//no errors? commit all transactions
if ($ErrorCount == 0){
odbc_commit($conn);
}// else rollback
else{
odbc_rollbak($conn);
}
odbc_close($conn);
?>
Hope this is helpful to someone.
Cheers,
Ron