这是一个数组print_r($_POST)
Array
(
[january] => Array
(
[0] => 10
[1] => 20
[2] => 5
)
[february] => Array
(
[0] => 9
[1] => 8
[2] => 10
)
[march] => Array
(
[0] => 2
[1] => 5
[2] => 6
)
)
循环为$_POST
.
$data = array();
foreach ($_POST as $key => $value) {
$data[] = $value;
}
陈述
INSERT INTO table (january,february,march) VALUES (".implode(", ", $data).")
使用这个当前数组,我该如何做出正确的陈述?我想存储这样的数据
id january february march
--------------------------
1 10 9 2
2 20 8 5
3 5 10 6