php – sync records in bulk using MySQL-ThrowExceptions

Exception or error:

In this scenario I have two tables Table A and Table B
Now get all records from the Table A which have a label “Updated” and “synced” = 0.

Now I loop through each record and update the records in Table B,and changed the synced column in Table A = 1.But this process takes hours and sometimes MySQL return Failed to response data
I have shared the code

$RecordTableA = 100000rows <br>
foreach ($RecordTableA as $val) { <br>
   $commands = Update Table B SET allcolumnB WHERE bla blaa;<br>
   $commands->execute();<br>
}<br>
$cmd = Update Table A SET synced = 0 WHERE label = updated;<br>
$cmd->execute();<br>
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *