這是代碼: if ($param1 == 'do_update') { $data['student_id'] = $this->input->post('student_id'); $data['title'] = html_escape($this->input->post('title')); if ($this->input->post('description') != null) { $data['description'] = html_escape($this->input->post('description')); } $data['amount'] = html_escape($this->input->post('amount')); $data['amount_paid'] = html_escape($this->input->post('amount_paid')); $data2['amount'] = html_escape($this->input->post('amount')); /*$data['status'] = $this->input->post('status');*/ $data['creation_timestamp'] = strtotime($this->input->post('date')); $this->db->where('invoice_id', $param2); $this->db->update('invoice', $data); $this->db->where('invoice_id', $param2); $this->db->update('payment', $data2);2 表發(fā)票和付款...我可以使用特定 ID 更新“發(fā)票表”中的數(shù)據(jù),但同時,它正在更新“付款表”中的整個列而不是該特定 ID。我可以看出在最后 4 行中做錯了什么。$data 字段屬于 Invoice 表,$data2 字段屬于 Payment 表Invoice_id 在兩個表中都很常見..
1 回答

人到中年有點(diǎn)甜
TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個贊
你實(shí)際上并沒有使用你的 where 條件。嘗試:
$this->db->where('invoice_id', $param2)->update('invoice', $data); $this->db->where('invoice_id', $param2)->update('payment', $data2);
- 1 回答
- 0 關(guān)注
- 104 瀏覽
添加回答
舉報
0/150
提交
取消