这是我的功能
public function update_previous_fee($id, $date, $amount) {
$month = date("F, Y", strtotime($date));
$this->db->where('mwf_month', $month);
$this->db->where('mwf_student_id', $id);
$this->db->set('mwf_pay_day', $date, FALSE);
$this->db->set('mwf_payment', $amount, FALSE);
$this->db->update('mwf');
}
mwf_pay_day被设置为一些垃圾负值。我做错了什么?
答案 0 :(得分:0)
$dt=date("Y-m-d", strtotime($date)); //converting the format as per the database format.
$month = date("F, Y", strtotime($date));
$this->db->where('mwf_month', $month);
$this->db->where('mwf_student_id', $id);
$this->db->set('mwf_pay_day', $dt, FALSE);
$this->db->set('mwf_payment', $amount, FALSE);
$this->db->update('mwf');
希望现在能为你效劳。
答案 1 :(得分:0)
我找到了解决方案。
更改行
$this->db->set('mwf_pay_day', $date, FALSE);
到
$this->db->set('mwf_pay_day', $date, TRUE);
解决了这个问题。
有关详细信息,请参阅here $this->db->set();