note 44945 added to function.odbc-autocommit
| From: | rlegend2 at pacbell dot net | Date: | Fri, 20 Aug 2004 20:57:03 +0000 |
| Subject: | note 44945 added to function.odbc-autocommit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75020@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.odbc-autocommit.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44945
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44945&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44945&report=yes
Search -- http://master.php.net/manage/user-notes.php