Listing doctors information using pagination. But listing all doctors information from Database in one page.
Controller
public function doctor_userlist_view($offset = 0)
{
$config["base_url"] = base_url() . "User/doctor_userlist_view/";
$config['total_rows'] = $this->db->count_all_results('tbl_doctor');
$config['per_page'] = 4;
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = 'Prev';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = 'Next';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
$data['docList'] = $this->User_model->get_all_userdoctor($config['per_page'], $offset);
$data['get_specs'] = $this->specialisation_model->get_specialisation();
$data['docsideList'] = $this->User_model->get_all_userdocside();
$data['get_specs'] = $this->specialisation_model->specialisation_get();
$this->load->view('customer/header', $data);
$this->load->view('customer/side_view', $data);
$this->load->view('customer/doctor', $data);
$this->load->view('customer/footer');
}
My view
<div class="list">
<ul>
<?php
if(isset($docList)):
foreach ($docList->result() as $row):
?>
<li><div class="imgt"><img src="<?php echo base_url("./resources/images/"); if($row->dr_img) echo $row->dr_img; else echo "no-img.jpg"; ?>" height="90px" width="82px"></div><div class="text"><h3><b>Dr. <?php echo $row->dr_name;?></b><br></h3><p><?php echo $row->spec_specialise; ?><br><?php echo $row->district;?><br><?php echo $row->state;?></p></div><div class="text"></div><div class="link"><a href="<?php echo site_url('User/doctor_details_view/'.$row->id); ?>"><i class="ace-icon fa fa-eye sym"></i>View</a></div></li>
<?php endforeach;
endif;
?>
</ul>
<div class="space">
</div>
</div></div>
<div class="pdt_rightt">
<center>
<?php
echo $this->pagination->create_links();
?>
</center>
</div>
Pagination is not working properly in all links showing the same data. I use same code for listing hospitals in that pagination is working.