我有一個二維數組如下:與SQL語句的foreach在二維數組
Array(
[1] => Array
(
[0] => 15956,3
[1] => 15984,0.13
[2] => 15940,1
)
[2] => Array
(
[0] => 15918,0.5
[1] => 15970,0.5
[2] => 15902,0.5
[3] => 15943,0.5
)
我將如何整合foreach循環都要經過陣列的每個孩子,並生成一個動態SQL語句...例如:
UPDATE main_stock SET on_hand -= 3 WHERE Rcode = 15918
UPDATE main_stock SET on_hand -= 0.13 WHERE Rcode = 15984
等等...