0

Hello

I am build pagination but its give me stuck.

admin_cont Controller Page

$this->load->library('pagination');

$config['base_url'] = "http://localhost/Job-portal-CI/admin_cont/search_me";
$config['total_rows'] = $this->db->get("admin_emp_job_description")->num_rows();
$config['per_page'] = 2;
$config['num_links'] = 20;


$this->pagination->initialize($config);

$data['records'] = $this->db->get('admin_emp_job_description',$config['per_page'],$this->uri->segment(3));

$this->load->view('admin_jobseeker/search_lists',$data);

View Page

<?php echo $this-> table-> generate($records); ?>    
<?php echo $this->pagination->create_links(); ?>

Problem

Its give me Link but when click on Next or 2 then given me blank page

Any One can suggest me what can i do for next..

Thank$

Edited by ravi142

3
Contributors
6
Replies
47
Views
3 Years
Discussion Span
Last Post by ravi142
0

eg The second and third parameters enable you to set a limit and offset clause:

$query = $this->db->get('mytable', 10, 20);

// Produces: SELECT * FROM mytable LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)

0

RePost In Controller

$config["base_url"] = base_url() . "search_me/";
$config["total_rows"] = $this->admin_jobseeker_model->record_count();
$config["per_page"] = 2;
$config["uri_segment"] = 2;

$this->pagination->initialize($config);

$page = ($this->uri->segment(2))? $this->uri->segment(2) : 0;
$data["results"] = $this->admin_jobseeker_model->get_records($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();

In Model

function record_count()
    {
        return $this->db->count_all("admin_emp_job_description");
    }

function get_records($limit, $start)
    {
        $this->db->limit($limit,$start);
        $query = $this->db->get("admin_emp_job_description");
        $this->output->enable_profiler(TRUE);
        if($query->num_rows() > 0)
        {
            foreach($query->result() as $row){

                    $data[] = $row;
            }
                return $data;
        }
            return false;
    }

In Routes

$route['search_me/(:any)'] = "admin_cont/search_me/$1";

Problem: Pagination URL link not working

0

Solved this One.
I just make seprate function rather then index()
so now i Apply in index() and $config["base_url"] = "controller/index"

Edited by ravi142

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.