无法提交表格,我有一个错误。遇到PHP错误
严重程度:注意
消息:试图获取非对象的属性
文件名:controllers / Admin.php行号:253回溯:文件:C:\ OpenServer \ domains \ medicalsystem.com \ application \ controllers \ Admin.php行:253功能:_error_handler Blockquote
if ($task == "create"){
$email = $_POST['email'];
$patient = $this->db->get_where('patient', array('email' => $email))->row()->name;
if ($patient == null) {
$this->crud_model->save_patient_info();
$this->session->set_flashdata('message', get_phrase('patient_info_saved_successfuly'));
} else {
$this->session->set_flashdata('message', get_phrase('duplicate_email'));
}
redirect(base_url() . 'index.php?admin/patient');
}
错误行代码
$patient = $this->db->get_where('patient', array('email' => $email))->row()->name;
这条线有问题。
试试这个:
if ($task == "create"){
$email = $_POST['email'];
$patient = $this->db->get_where('patient', array('email' => $email))->result_array();
if ($patient == null) {
$this->crud_model->save_patient_info();
$this->session->set_flashdata('message', get_phrase('patient_info_saved_successfuly'));
} else {
$this->session->set_flashdata('message', get_phrase('duplicate_email'));
}
redirect(base_url() . 'index.php?admin/patient');
}
如果要访问患者姓名,则可以访问 $patient['name']
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句