Welcome Guest, Not a member yet? Register   Sign In
Help with pagination and custom query
#1

[eluser]fiktionvt[/eluser]
I am trying to use pagination with a custom query that I have created. This means that I can not use the $this->db->get('table', $limit, $offset); function becuase my query is for join tables and has a unique result. Does anyone know how to do this? It currently is working and prints out the links and everything but once I click on the link it says that Page can not be found. My code is below.

I am really confused at how the limit and offset get updated? Also as a side note, my query can either take 2 params for the limit and offset or no params to get everything. It takes care of that. Thanks for any of the help!

Code:
class admin extends Controller {

    function admin(){
        parent::Controller();
        $this->load->library('pagination');

    }

    function audit(){
    
        $limit = 0;
        $offset = 25;

        $config['base_url'] = $this->config->site_url().'/admin/audit';
        $config['total_rows'] = $this->db->run_audit()->recordCount();
        $config['per_page'] = $offset;
        $config['num_links'] = 19;
        
        $this->pagination->initialize($config);

        $data['records'] = $this->db->run_audit($limit, $offset);

        $this->load->vars($data);
        $this->load->view('admin/admin_audit', $data);
    }
}




Theme © iAndrew 2016 - Forum software by © MyBB