Welcome Guest, Not a member yet? Register   Sign In
Pagination problems
#1

[eluser]buckboru[/eluser]
Hi,
I have been looking at examples of using pagination. I am trying to implement this but i'm having some issues. Basically i get an error on this
$config['total_rows'] = $this->db->count_all('tstmis.phoned01');
saying that Call to a member function count_all() on a non-object

This is what my controller looks like
Code:
<?php
class Phonelist extends Controller
{
    function index()
    {
        //this gives us redirect
        $this->load->helper('url');
                // load pagination class
           $this->load->library('pagination');
           $config['base_url'] = base_url().'index.php/phonelist/list_users/';
        $config['total_rows'] = $this->db->count_all('tstmis.phoned01');
        $config['per_page'] = '5';
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $this->pagination->initialize($config);

        redirect('phonelist/list_users');
    }
    
    function list_users()
    {
    
        $this->load->database();
        $this->load->model('phone_model');
        $data['phonelist'] = $this->phone_model->get_phonelist();
        
        // This gives us anchor() - see the view at the end
        $this->load->helper('url');
         $this->load->view('phonelist_view', $data);
    }
    
    function view_job($id = false)
    {
        $this->load->helper('url');
        if (!$id) redirect ('jobs/list_jobs');
        
        $this->load->database();
        $this->load->model('jobs_model');
        $data['jobs'] = $this->jobs_model->get_job($id);
        
        $this->load->view('job_view',$data);
    }
}
Below works fine in my model
Code:
$query = $this->db->get('tstmis.phoned01');
    foreach ($query->result_array() as $row)
    {
      $result[] = $row;
    }
    
        return $result;
Any ideas?

Thanks


Messages In This Thread
Pagination problems - by El Forum - 08-29-2008, 10:29 AM
Pagination problems - by El Forum - 08-29-2008, 10:36 AM
Pagination problems - by El Forum - 08-29-2008, 10:39 AM
Pagination problems - by El Forum - 08-29-2008, 10:45 AM
Pagination problems - by El Forum - 08-29-2008, 11:31 AM
Pagination problems - by El Forum - 08-29-2008, 11:42 AM
Pagination problems - by El Forum - 08-29-2008, 11:45 AM
Pagination problems - by El Forum - 08-29-2008, 11:54 AM
Pagination problems - by El Forum - 08-29-2008, 12:02 PM
Pagination problems - by El Forum - 08-29-2008, 01:31 PM
Pagination problems - by El Forum - 08-29-2008, 02:31 PM
Pagination problems - by El Forum - 09-03-2008, 07:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB