这是根据日期将新行插入表中的函数。如果行已经存在,我想避免重复行。该函数基本上将2014年11月插入为mwf_month,因此mwf_student_id和mwf_month对对于该行是唯一的。我应该做些什么修改来避免这种重复?根据日期将行插入表中
public function month_wise_due($grade_due, $new_due, $id, $remaining) {
$now1 = time();
$now = date('F, Y', $now1);
$store = array(
'mwf_month' => $now,
'mwf_previous' => $remaining,
'mwf_due' => $grade_due,
'total_due' => $new_due,
'mwf_student_id' => $id,
'mwf_pay_day' => 'Not Yet Paid',
'mwf_payment' => 0,
'mwf_diff' => $new_due
);
$this->db->trans_start();
$this->db->insert('mwf', $store);
$this->db->trans_complete();
}