請問一下
Array
(
[after_one] => Array
(
[0] => 124124
[1] => 2342
)
[task_one] => Array
(
[0] => 124
[1] => 41234234
)
[time_one] => Array
(
[0] => 2017-05-19
[1] => 2017-05-19
)
[complete_one] => Array
(
[0] => 完成途中
[1] => 未完成
)
[score_one] => Array
(
[0] => 2
[1] => 2
)
[reason_one] => Array
(
[0] => 124124
[1] => 124124
)
[next_one] => Array
(
[0] => 412412
)
[task_two] => Array
(
[0] => 12412
)
[time_two] => Array
(
[0] => 2017-05-13
)
[result_two] => Array
(
[0] => 124124
)
[reason_two] => Array
(
[0] => 1231234
)
)
這個怎麼插入到資料庫啊?怎麼循環?這裡是兩個數據 【0】一條 【1】一條 ,求大神幫幫忙,謝謝了
各位不好意思,現在補充一下資料庫結構
id after_one task_one time_one complete_one score_one reason_one next_one task_two time_two result_two reason_two
這些都是欄位名稱。現在按照這個應該是兩條數據,該怎麼插入到資料庫?
漂亮男人2017-05-24 11:35:24
這樣不就實現了?
$beans=array();
foreach($data as $k=>$v){
foreach($v as $vK=> $vItem)
{
$beans[$vk][$k]=$vItem;
}
}
var_dump($beans);
phpcn_u15822017-05-24 11:35:24
自己循環處理一下就行了。
.................
$arr1=array();
$arr2=array();
for($arr as $k=>$v){
$arr1[$k]=$arr[$k][0];
$arr2[$k]=$arr[$k][1];
}