@dedrick
To create a pagination query string in CodeIgniter, follow these steps:
1
|
$this->load->library('pagination'); |
1 2 3 4 5 6 |
$config = array(); $config["base_url"] = base_url() . "controller/method"; $config["total_rows"] = $total_rows; // Total number of rows to paginate $config["per_page"] = $per_page; // Number of results per page $this->pagination->initialize($config); |
1
|
echo $this->pagination->create_links(); |
1 2 3 |
$page = ($this->input->get('per_page')) ? $this->input->get('per_page') : 0; $data['results'] = $this->your_model->get_results($config["per_page"], $page); |
Make sure to replace controller
, method
, your_model
, $total_rows
, $per_page
, and get_results
with your actual controller, method, model, total rows count, per page limit, and method to fetch results, respectively.
This will create a pagination query string in CodeIgniter, allowing users to navigate through pages of results.