I need to insert rows to more than one table and the number of rows that I need to insert is not fixed . I am using mysqli_multi_query() to do all my insert queries in a single step.
I need to execute all my queries successfully or else if one of the queries failed revert to original table .
How can I do this ?
My query is
insert into `_survey_user_map` (`user`,`survey`) values('anu','1')
on duplicate key update survey
='1';
delete from _survey_db
where user
='anu';
Use transactions.