0

I have an array which comprises many table and and their contents value for updating, I use foreach loop to get one by one a table and their updating record, then call a function which update the table

Code:

foreach($tables as $key=>$value) {
    function inset_data_into_table(take_table_name , table_field_and_value);
}

For example: If there are three table in array then three loops would be run, if two loops executed successfully but in third loop if there is an error come, then I want to rollback previous two loops inserted data. How it is possible.

  • 2
    possible duplicate of [PHP + MySQL transactions examples](http://stackoverflow.com/questions/2708237/php-mysql-transactions-examples) – jynus Jul 04 '14 at 08:25
  • No this is differenct case, Here we are calling function in loop. Please read the question once again carefully. – Sajid Ali Khan Jul 04 '14 at 09:07
  • @SajidAliKhan But if function or not: The idea is the same ... – Yannici Jul 04 '14 at 09:45

0 Answers0