Mysql: ROLLBACK for multiple queries
- by Raj
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!!!