using autocommit functionality to rollback transactions in a "workspace"
<?php
$conn = odbc_connection("$DSN","USER","PASS");
odbc_autocommit($conn,FALSE);
$query1 = "some SQL";
$query2 = "some more SQL";
$ErrorCount = 0;
$result = odbc_exec($conn,$query1) or $ErrorCount++;
$result2 = odbc_exec($conn,$query2) or $ErrorCount++;
if ($Errorcount == 0){
odbc_commit($conn);
echo "transaction successful";
}
else{
odbc_rollback($conn);
echo "there were errors processing the transaction.
No changes were made to the database";
}
odbc_close($conn);
?>
Cheers,
Ron