Skip to content

Instantly share code, notes, and snippets.

@rintoug
Last active June 4, 2017 07:50
Show Gist options
  • Save rintoug/c23aa3336764b9c9723b06413c48bc86 to your computer and use it in GitHub Desktop.
Save rintoug/c23aa3336764b9c9723b06413c48bc86 to your computer and use it in GitHub Desktop.
How to do Pagination in CodeIgniter
<?php
class Country_model extends CI_Model {
public function __construct()
{
parent::__construct();
}
public function total_rows()
{
return $this->db->count_all("apps_countries");
}
public function get_countries($limit, $start)
{
$this->db->limit($limit, $start);
$query = $this->db->get("apps_countries");
if ($query->num_rows() > 0) {
return $query->result_array();
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment