CodeIgniter を使用して Web サイトを開発しています。ページを開くと、次のエラーが表示されます。
私はこれまでこの問題に遭遇したことがなく、データベース ライブラリを使用するすべてのコントローラーでこの問題が発生していることを知っています。
これは、エラーが発生するモデルの関数の例です。
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');