hi, Hello, everyone.
there are now ten pieces of data that need to be inserted and ten pieces of data that need to be updated. The data that needs to be inserted in suspense is a1memery a2magina3.a10, and the data that needs to be updated is b1memb2recoverb3.b10.
you need to ensure that all data operations succeed or fail at the same time. (that is, transactions).
and you need to update the primary key ID of A1 to a field of b1, a2 to a field of b2, and so on.
what I"m doing now is:
foreach($arr_a AS $a){
//
// a1 id1
//ID b1
//
}
but there are several problems with this:
(1) does using transactions in a loop cause performance problems?
(2) if an exception is thrown, some data cannot be manipulated. The outermost layer plus business?
does the Great God have any good solutions? For guidance ~ Thank you very much!