Guest User

Untitled

a guest
Nov 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: heri
  5. * Date: 11/15/17
  6. * Time: 10:27 PM
  7. */
  8.  
  9. require APPPATH . 'libraries/REST_Controller.php';
  10. class Jsonandroid extends REST_Controller
  11. {
  12. function __construct($config = 'rest')
  13. {
  14. parent::__construct($config);
  15. // $this->load->database();
  16. $this->load->model('/crudandroid/jsonandroidmodel');
  17. }
  18. function index_get(){
  19. $id = $this->get('npm');
  20. if ($id == ''){
  21. $database = $this->db->get('tb_mahasiswa')->result();
  22. }else{
  23. $this->db->where('npm', $id);
  24. $database = $this->db->get('tb_mahasiswa')->result();
  25. }
  26. $this->response($database, 200);
  27.  
  28. }
  29.  
  30. public function index_delete(){
  31. $npm = $this->uri->segment(3);
  32. $delete = $this->jsonandroidmodel->delete($npm);
  33. $this->response($delete);
  34. }
  35. //
  36.  
  37.  
  38. }
Add Comment
Please, Sign In to add comment