[PHP-DB] Problem with BDB ,can anybody help me!!!
I have a Linux Server, with Apache 1.3.19 + PHP 4.0.6 and MySQL 3.23.37, and i have a trouble with Transactions in PHP code: When i write a transaction, and some error (PHP lang error) occurs, the transaction are autocommited, and only part of the querys are made, with the inconsistence of data, that this make, here a example of my problem: . . . // Start transaction $q = "BEGIN WORK" $db->query($q); if( $db->errno) { echo "Can't start transaction."; return; } $q = "UPDATE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } $q = "DELETE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } // Here a error halts the code exit; // halt by hand // Some other querys $q = "DELETE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } $db->query("COMMIT"); In this example the $db->query("COMMIT"); command are never executed, and the 2 first querys are executed, and the last and never executed. How i can solve this?? Can anybody help me!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Problem with BDB
I have a Linux Server, with Apache 1.3.19 + PHP 4.0.6 and MySQL 3.23.37, and i have a trouble with Transactions in PHP code: When i write a transaction, and some error (PHP lang error) occurs, the transaction are autocommited, and only part of the querys are made, with the inconsistence of data, that this make, here a example of my problem: . . . // Start transaction $q = "BEGIN WORK" $db->query($q); if( $db->errno) { echo "Can't start transaction."; return; } $q = "UPDATE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } $q = "DELETE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } // Here a error halts the code exit; // halt by hand // Some other querys $q = "DELETE "; $db->query($q); if( $db->errno) { echo "Error."; $db->query( "ROLLBACK"); return; } $db->query("COMMIT"); In this example the $db->query("COMMIT"); command are never executed, and the 2 first querys are executed, and the last and never executed. How i can solve this?? Can anybody help me!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]