SHARE
TWEET

Untitled

a guest Dec 7th, 2019 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     /**
  3.      *
  4.      */
  5.     class API extends CI_Controller
  6.     {
  7.  
  8.         public function index()
  9.     {
  10.         date_default_timezone_set('Asia/Jakarta');
  11.         error_reporting(E_ALL);
  12.         ini_set('display_errors', 1);
  13.         $this->load->helper('date');
  14.     }
  15.    
  16.  
  17.     public function getSlider(){
  18.         $data = array();
  19.        
  20.        
  21.        
  22.         $sql = "SELECT * FROM tb_kategori_wisata, tb_wisata WHERE tb_wisata.id_kategori = tb_kategori_wisata.id_kategori AND tb_wisata.is_slider = 1 ORDER BY tb_wisata.id_wisata DESC";
  23.  
  24.         $q = $this->db->query($sql);
  25.         if($q->num_rows() > 0){            
  26.             $data['result'] = 'true';
  27.             $data['msg'] = 'Data Slider';
  28.             $data['data'] = $q->result();
  29.         }else{
  30.             $data['result'] = 'false';
  31.             $data['msg'] = 'Tidak ada data menu';
  32.         }
  33.        
  34.         #pre($this->db->last_query());
  35.         echo json_encode($data);
  36.     }
  37.  
  38.     public function get_kategori(){
  39.         $data = array();
  40.        
  41.         $sql = "SELECT * FROM tb_kategori_wisata";
  42.         $q = $this->db->query($sql);
  43.         if($q->num_rows() > 0){            
  44.             $data['result'] = 'true';
  45.             $data['msg'] = 'Data Kategori';
  46.             $data['data'] = $q->result();
  47.         }else{
  48.             $data['result'] = 'false';
  49.             $data['msg'] = 'Tidak ada data';
  50.         }
  51.        
  52.         #pre($this->db->last_query());
  53.         echo json_encode($data);
  54.     }
  55.  
  56.     public function wisataByIdKategori(){
  57.         $data = array();
  58.         $id_kategori = $this->input->post('id_kategori');
  59.         //$this->db->where('id_resto', $idresto);
  60.         $sql = "SELECT * FROM tb_kategori_wisata, tb_wisata WHERE tb_wisata.id_kategori = tb_kategori_wisata.id_kategori AND tb_wisata.id_kategori = '$id_kategori' ORDER BY tb_wisata.id_wisata DESC";
  61.         $q = $this->db->query($sql);
  62.         if($q->num_rows() > 0){            
  63.             $data['result'] = 'true';
  64.             $data['msg'] = 'Data Wisata';
  65.             $data['data'] = $q->result();
  66.         }else{
  67.             $data['result'] = 'false';
  68.             $data['msg'] = 'Tidak ada data wisata';
  69.         }
  70.        
  71.         #pre($this->db->last_query());
  72.         echo json_encode($data);
  73.     }
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top