數我試圖將數據插入表中for
循環:插入行和投入使用後
public function insertprolist()
{
for ($i = 1; $i < $this->input->post('numrows'); $i = $i + 1)
{
$data = array(
'productname' => $this->input->post('proname'+$i),
'quantity' => $this->input->post('quantity'+$i),
'price' => $this->input->post('price'+$i),
'amount' => $this->input->post('amount'+$i)
);
return $this->db->insert('purchaseprolist', $data);
}
}
我得到一個錯誤。
它沒有被插入到數據庫表中。
我已經附加了輸入字段的新行,其名稱proname1
,quantity1
和輸入name屬性會proname2
,quantity2
生成的第二行,並將其繼續下去。
我正在檢索名稱爲numrows
的另一個輸入中的行數。
現在我想在模態文件中訪問這些輸入。
請幫我這個:) – Ramya
是什麼問題?錯誤? – Blinkydamo
它沒有被插入數據庫表 – Ramya