ci框架$this->db->where得不到结果

用ci写登录代码,用$this->db->where查询数据库验证账号密码时得到的总是空的返回值
以下是控制器中验证的函数代码:

public function validate_credentials(){
        $this->load->model('Bookmark_models');
        $query = $this->Bookmark_models->where();
        
        if ($query){
            $data = array('username' => $this->input->post('username'),
                          'is_loggrd_in' => true);
            $this->session->set_userdata($data);
            $this->load->view('logged_in_area');
        }else {
            $this->login();
        }

以下是模型中的代码:

public function where(){
        $this->db->where('username',$this->input->post('username'));
        $this->db->where('passwd',sha1($this->input->post('password')));
        $query = $this->db->get('user');
        
        if ($query->num_rows == 1){
            return true;
        }
查看回复