Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // application/models/person.php
- class Person_Model extends ORM {
- protected $title;
- protected $forenames;
- protected $surname;
- protected $degrees;
- //Construct
- function construct ( $title, $forenames, $surname, $degrees) {
- $this->title = $title;
- $this->forenames = $forenames;
- $this->surname = $surname;
- $this->degrees = $degrees;
- }
- public function count_people()
- {
- $query = $this->db->select ('id')->get('people');
- return $query->count();
- }
- public function browse ($limit, $offset)
- {
- return $this->db->select
- (
- 'title',
- 'forenames',
- 'surname',
- 'degrees'
- )
- ->from ('people')
- ->where ('role=9')
- ->limit ($limit, $offset)
- ->get ();
- }
- //$this->db = Database::instance(); // add this line
- // makes database object available to all controllers
- }
- ?>
Add Comment
Please, Sign In to add comment