使用codeigniter的分页显示不同的错误

时间:2018-09-08 06:48:29

标签: php pagination codeigniter-3

在控制器中,userRegistered方法显示error。我还加载了分页

在stackoverflow上,当我按名称(不支持的操作类型)查询错误时,它显示与模型有关的某物。 是由于控制器方法引起的错误还是来自模型。我无法确定出现了什么问题 this image

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;
  }

0 个答案:

没有答案