代码:
$data = array(
'fname' => isset($this->input->post('fname')) ? $this->input->post('fname'):"",
'lname' => isset($this->input->post('lname')) ? $this->input->post('lname'):"",
'gender' => isset($this->input->post('gender')) ? $this->input->post('gender'):"",
'dob' => isset($this->input->post('dob')) ? $this->input->post('dob'):"",
'marital_status' => isset($this->input->post('marital_status')) ? $this->input->post('marital_status'):"",
);
$sql = $this->db->insert('personal_detail',$data);
在此代码中,我具有表personal_detail
,并且已将fname,lname,gender,dob,marital_status
定义为列名,并且在单击“提交”按钮(即
Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
,如果我删除了isset()
,它将显示Column 'fname' not to be null
。因此,我该如何解决该问题。请帮助我。
谢谢