Skip to content

Instantly share code, notes, and snippets.

@azazqadir
Created January 16, 2018 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azazqadir/2c4ace1535054c65892bb42202f6a42d to your computer and use it in GitHub Desktop.
Save azazqadir/2c4ace1535054c65892bb42202f6a42d to your computer and use it in GitHub Desktop.
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