0
我有數組我想插入數據庫中的值使用codeigniter,我不知道如何插入,我試圖但我無法得到答案如何在數據庫中使用每個循環的數組值插入
我的模型
的print_r($ subjectHandling);
Array
(
[subjectId] => Array
(
[0] => 1
[1] => 2
)
)
現在我想在這個值插入數據庫中的值。
我想這樣
foreach($subjectHandling as $key=>$value) {
$reg_dat = array(
'statffId' => '1',
'subjectId' => $value,
);
$this->db->insert("subject_handling" , $reg_dat);
}
我米得到錯誤**數組到字符串轉換**,所以如何做到這一點。我想在DATABSE