我正在使用 CodeIgniter 开发一个网站。当我打开我的页面时,我收到此错误:
我以前没有遇到过这个问题,并且知道我在每个使用数据库库的控制器中都有它。
这是模型中出现错误的函数示例:
public function login($pseudo,$password)
{
$this->db->where("pseudo",$pseudo);
$this->db->where("password",$password);
$query=$this->db->get("admin");
if($query->num_rows()>0)
{
foreach($query->result() as $rows)
{
//add all data to session
$newdata = array(
'admin_id' => $rows->id,
'admin_pseudo' => $rows->pseudo,
'admin_fullname' => $rows->fullname,
'admin_email' => $rows->email,
'admin_logged_in' => TRUE,
);
}
$this->session->set_userdata($newdata);
return true;
}
return false;
}
第 13 行是:$this->db->where("pseudo",$pseudo);
这是控制器:
public function login()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('login', 'Pseudo', 'trim|required|min_length[4]|max_length[32]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
$pseudo=$this->input->post('login');
$password=md5($this->input->post('password'));
$result=$this->admin_model->login($pseudo,$password);
if($this->form_validation->run() == FALSE)
{
$this->index();
}
else
{
if ($result) $this->dashboard();
else
$this->index();
}
}
在自动加载文件中我有:
$autoload['libraries'] = array('database','session');