Add Codedump

Description (Markdown supported)Creating Model, Controller and View for a Pagination System in CodeIgniter Application. Source: https://www.cloudways.com/blog/pagination-in-codeigniter/
Title or filename
Language
Code<?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;    } }
Title or filename
Language
Code<?php class Welcome extends CI_Controller {    public function __construct() {        parent:: __construct();        $this->load->helper("url");        $this->load->model("Departments");        $this->load->library("pagination");    }    public function departmentdata() {        $config = array();        $config["base_url"] = base_url() . "welcome/departmentdata";        $config["total_rows"] = $this->Departments->record_count();        $config["per_page"] = 5;        $config["uri_segment"] = 3;        $this->pagination->initialize($config);        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;        $data["results"] = $this->Departments->            fetch_departments($config["per_page"], $page);        $data["links"] = $this->pagination->create_links();        $this->load->view("departmentdata", $data);    } }
Remove this code
Title or filename
Language
Code<body> <div id="container">    <div id="body">        <?php        foreach($results as $data) {            echo $data->Departments . " - " . $data->Labs . "<br>";        }        ?>        <p><?php echo $links; ?></p>    </div> </div> </body>
Remove this code

Access