我有一个名为的数组$works
,如下所示:
[
'type' => [1, 5],
'description' => [2, 6],
'hours' => [3, 7],
'amount' => [4, 8]
]
我需要在两次迭代中将所有值发送到数据库(MySQL)。就像是:
INSERT INTO `works` (`type`, `description`, `hours`, `amount`) VALUES (works[type][0], works[decsription][0], works[hours][0], works[amount][0]);
INSERT INTO `works` (`type`, `description`, `hours`, `amount`) VALUES (works[type][1], works[description][1], works[hours][1], works[amount][1]);