daily pastebin goal
10%
SHARE
TWEET

ApiTrnsksi.php

roynaldoindra Aug 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. require APPPATH . '/libraries/REST_Controller.php';
  6. use Restserver\Libraries\REST_Controller;
  7.  
  8. class ApiTransaksi extends REST_Controller {
  9.  
  10.     function __construct($config = 'rest') {
  11.         parent::__construct($config);
  12.         $this->load->database();
  13.     }
  14.  
  15.  
  16. function index_get() {
  17.   $id = $this->get('id_pemesan');
  18.   $where = '';
  19.  
  20.   if($id != null){ $where = 'WHERE reservasi.id_pemesan = "'.$id.'" '; }
  21.   $query = $this->db->query('SELECT admin.nama,reservasi.id_pesan,reservasi.status_pesan,reservasi.id_pemesan
  22.   FROM reservasi
  23.   LEFT JOIN admin ON (reservasi.id_admin = admin.id_user)
  24.   LEFT JOIN customer ON (reservasi.id_pemesan = customer.id_cust) '.$where.' ORDER BY reservasi.id_pesan DESC;');
  25.   $output = $query->result_array();
  26.   $this->response(array('data'=>$output));
  27.   /*$query = $this->db->select('*')->from('admin');
  28.       if($id != null){
  29.         $query->where('id_user',$id);
  30.       }
  31.   $output = $query->get()->result_array();
  32.  
  33.   $data_blog = $this->db->select('*')->from('blog');
  34.   if($id != null){
  35.     $data_blog->where('id_admin',$id);
  36.   }
  37.  
  38.   $output_blog = $data_blog->get()->result_array();
  39.  $this->response(array('data'=>$output,"blog" => $output_blog));*/
  40.  
  41.  
  42. }
  43.  
  44. }
RAW Paste Data
Top