Mysql: ROLLBACK for multiple queries
Posted
by
Raj
on Stack Overflow
See other posts from Stack Overflow
or by Raj
Published on 2010-12-29T15:07:49Z
Indexed on
2010/12/29
15:54 UTC
Read the original article
Hit count: 305
Hi I have more than three MySql queiries in a PHP script triggered by scheduled task. If a query catch an error, script throw an exception and rollback that Mysql query. It works fine.
However if first query works fine, but not 2nd query, throw an exception, it rollback 2nd one but not 1st query.
I am using begin_trans(), commit and rollback() for individual queries because Sometimes i need to rollback one query, sometimes all queries. Is there any way to rollback one query or all queries?
Thanks in advance
UPDATE:
I got it working, there was no problem with in begin_trans(), commit and rollback(), the database connection config was different for one query from other queries, crazy code without any comments!!!
© Stack Overflow or respective owner