Hi all, I've seen the following code in MySQL cookbook:
eval { # move some money from one person to the other $dbh->do ("UPDATE money SET amt = amt - 6 WHERE name = 'Eve'"); $dbh->do ("UPDATE money SET amt = amt + 6 WHERE name = 'Ida'"); # all statements succeeded; commit transaction $dbh->commit ( ); }; if ($@) # an error occurred { print "Transaction failed, rolling back. Error was:\n$@\n"; # roll back within eval to prevent rollback # failure from terminating the script eval { $dbh->rollback ( ); }; } --- Well, I don't understand why I need to check if $@ is true or false. If there wasn't any error, and the program should not rollback, in fact it could give the rollback command because it won't produce any effect after the commit command was given. Am I wrong? Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php