azazqadir
1/16/2018 - 6:51 AM

Creating Pagination Feature in CodeIgniter App. Learn how to create Model, Controller and View for Pagination in CodeIgniter: https://www.cl

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;

   }

}