Last active
September 18, 2016 01:11
-
-
Save sakukode/812fad2d5f5d5405ebd4c825d9eaff70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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