Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating Pagination Feature in CodeIgniter App. Learn how to create Model, Controller and View for Pagination in CodeIgniter: https://www.cloudways.com/blog/pagination-in-codeigniter/
<?php
class Departments extends CI_Model
{
   public function __construct() {
       parent::__construct();
   }
   public function record_count() {
       return $this->db->count_all("Departments");
   }
   public function fetch_departments($limit, $start) {
       $this->db->limit($limit, $start);
       $query = $this->db->get("Departments");
       if ($query->num_rows() > 0) {
           foreach ($query->result() as $row) {
               $data[] = $row;
           }
           return $data;
       }
       return false;
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.