亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

嘗試更新 2 個表中的數據

嘗試更新 2 個表中的數據

PHP
江戶川亂折騰 2022-06-17 15:45:59
這是代碼:  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 表發票和付款...我可以使用特定 ID 更新“發票表”中的數據,但同時,它正在更新“付款表”中的整個列而不是該特定 ID。我可以看出在最后 4 行中做錯了什么。$data 字段屬于 Invoice 表,$data2 字段屬于 Payment 表Invoice_id 在兩個表中都很常見..
查看完整描述

1 回答

?
人到中年有點甜

TA貢獻1895條經驗 獲得超7個贊

你實際上并沒有使用你的 where 條件。嘗試:

$this->db->where('invoice_id', $param2)->update('invoice', $data);
$this->db->where('invoice_id', $param2)->update('payment', $data2);


查看完整回答
反對 回復 2022-06-17
  • 1 回答
  • 0 關注
  • 106 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號