在控制器中,userRegistered方法显示error。我还加载了分页
在stackoverflow上,当我按名称(不支持的操作类型)查询错误时,它显示与模型有关的某物。 是由于控制器方法引起的错误还是来自模型。我无法确定出现了什么问题
public function userRegistered(){
$this->load->library('pagination');
$data['admin'] = "Admin";
if($this->session->userdata('shubhamkapoor9798@gmail.com')){
$config["per_page"] = 20;
$config["uri_segment"] = 3;
$this->load->model('Registered');
$config["total_rows"] = $this->registered->getDB();
$data['users']=$this->registered->getDB();
//var_dump($arr);
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["results"] = $this->registered-
>fetch_countries($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$this->load->view('templates/adminHeader', $data);
$this->load->view('templates/adminNav', $data);
$this->load->view('admin/'.__FUNCTION__, $data);
$this->load->view('templates/adminFooter');
}else{
die('Unauthorized Access');
// halt for 5 seconds
}
模型 fetch_countries 方法
public function fetch_countries($limit, $start) {
$this->db->limit($limit, $start);
$query = $this->db->get("registereduser");
$results = array();
if ($query->num_rows() > 0) {
foreach ($query->result() as $result) {
$results[] = $result;
}
return $results;
}
return false;
}