db_regional = $this->load->database("regional", true); } function index() { echo "Api: Training Playground"; echo "
"; $cek = $this->db->query("select database() as current_db")->result(); // echo $this->db->last_query(); print_r($cek); } // function lookup_kelurahan_byname() // { // try { // //# cek token valid // if (! $this->isLogin) { // $this->sys_error("Invalid Token"); // exit; // } // $prm = $this->sys_input; // // tidak mandatory // $kelurahan = ""; // if (isset($prm['kelurahan'])) { // $kelurahan = trim($prm["kelurahan"]); // if ($kelurahan != "") { // $kelurahan = '%' . $prm['kelurahan'] . '%'; // } // } // $all = $prm['all']; // $limit = ''; // if($all == 'N'){ // $limit = ' LIMIT 10'; // } // $ROW_PER_PAGE = 10; // $number_offset = ($prm['current_page'] - 1) * $ROW_PER_PAGE ; // // $sql = "select COUNT(*) as total // // FROM(SELECT * // // from m_doctor // // JOIN m_specialist ON M_DoctorM_SpecialID = M_SpecialistID AND M_SpecialistIsActive = 'Y' // // WHERE // // M_SpecialistName LIKE CONCAT('%','{$specialist}','%') AND // // M_DoctorIsActive = 'Y' GROUP BY M_DoctorID) a"; // $sql = "select count(M_KelurahanID, M_KelurahanName) as total // from m_kelurahan // where M_KelurahanIsActive = 'Y' // AND M_KelurahanName = ?"; // $query_total_filter = $this->db_regional->query($sql,[$kelurahan]); // //echo $this->db_regional->last_query(); // $total_filter = 0; // $tot_page = 0; // if ($query_total_filter) { // $total_filter = $query_total_filter->result_array()[0]["total"]; // $tot_page = ceil($total_filter/$ROW_PER_PAGE); // } else { // $this->sys_error_db("m_kelurahan count", $this->db_regional); // exit; // } // // $sql = "select M_DoctorID as id, // // M_DoctorName as name, // // M_SpecialistID, // // M_SpecialistName, // // m_doctor.* // // from m_doctor // // JOIN m_specialist ON M_DoctorM_SpecialID = M_SpecialistID AND M_SpecialistIsActive = 'Y' // // WHERE // // M_SpecialistName LIKE CONCAT('%','{$specialist}','%') AND // // M_DoctorName LIKE CONCAT('%','{$doctor}','%') AND // // M_DoctorIsActive = 'Y' // // GROUP BY M_DoctorID // // ORDER BY M_SpecialistName ASC, M_DoctorName ASC // // limit $ROW_PER_PAGE offset $number_offset"; // $sql = "select count(M_KelurahanID, M_KelurahanName) as total // from m_kelurahan // where M_KelurahanIsActive = 'Y' // AND M_KelurahanName = ? // limit 10 offset ?"; // $sql_param = array($search); // $query = $this->db_regional->query($sql,[$kelurahan,$number_offset]); // //echo $this->db_regional->last_query(); // if ($query) { // $rows = $query->result_array(); // } else { // $this->sys_error_db("m_kelurahan select"); // exit; // } // $result = array ( // "total" => $tot_page, // "total_filter"=> $total_filter, // "records" => $rows // ); // $this->sys_ok($result); // } catch(Exception $exc) { // $message = $exc->getMessage(); // $this->sys_error($message); // } // } } ?>