Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sakukode/812fad2d5f5d5405ebd4c825d9eaff70 to your computer and use it in GitHub Desktop.

Select an option

Save sakukode/812fad2d5f5d5405ebd4c825d9eaff70 to your computer and use it in GitHub Desktop.
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class People_model extends CI_Model
{
protected $table = 'peoples'; // you MUST mention the table name
protected $primary_key = 'id'; // you MUST mention the primary key
public function get_all($limit, $page)
{
$offset = ($page - 1) * $limit;
$query = $this->db->limit($limit, $offset)->get($this->table);
return $query->result();
}
public function get_total()
{
return $this->db->count_all($this->table);
}
}
/* application/models/People_model.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment