Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. // application/models/person.php
  4.  
  5. class Person_Model extends ORM {
  6.  
  7. protected $title;
  8. protected $forenames;
  9. protected $surname;
  10. protected $degrees;
  11.  
  12. //Construct
  13. function construct ( $title, $forenames, $surname, $degrees) {
  14. $this->title = $title;
  15. $this->forenames = $forenames;
  16. $this->surname = $surname;
  17. $this->degrees = $degrees;
  18.  
  19. }
  20.  
  21. public function count_people()
  22. {
  23. $query = $this->db->select ('id')->get('people');
  24. return $query->count();
  25. }
  26.  
  27. public function browse ($limit, $offset)
  28.  
  29. {
  30. return $this->db->select
  31. (
  32. 'title',
  33. 'forenames',
  34. 'surname',
  35. 'degrees'
  36. )
  37. ->from ('people')
  38. ->where ('role=9')
  39. ->limit ($limit, $offset)
  40. ->get ();
  41. }
  42.  
  43. //$this->db = Database::instance(); // add this line
  44. // makes database object available to all controllers
  45. }
  46. ?>
Add Comment
Please, Sign In to add comment