我的代码有什么问题?
$count=$this->db_ecommerce->check_user($user, $pswd)->num_rows(); <-- this line 43
$user=$this->input->post('username');
$pswd=$this->input->post('password').$this->config->item("key_login");
//$pswd=$this->input->post('password');
$count=$this->db_ecommerce->check_user($user, $pswd)->num_rows();
if($count>0) {
$this->session->set_flashdata('status_login', 'ok');
redirect('member');
答案 0 :(得分:0)
假设您已经有一个名为db_ecommerce的模型,您应该尝试加载它:
$this->load->model('db_ecommerce');
$count=$this->db_ecommerce->check_use ...
答案 1 :(得分:0)
在获得num_rows()之前,您应该检查是否有任何结果:
$count = $this->db_ecommerce->check_user($user,$pswd);
if($count){
$count = $count->num_rows();
}
else{
$count = 0;
}