db_onedev = $this->load->database("onedev", true); } public function search() { $prm = $this->sys_input; $max_rst = 12; $tot_count =0; $q = [ 'search' => '%' ]; if ($prm['search'] != '') { $q['search'] = "%{$prm['search']}%"; } // QUERY TOTAL $sql = "select count(*) total from m_kelurahan where M_KelurahanIsActive = 'Y' and M_KelurahanName like ?"; $query = $this->db_onedev->query($sql, array($q['search'])); if ($query) { $tot_count = $query->result_array()[0]["total"]; $tot_count = 4; } else { $this->sys_error_db("m_kelurahan count",$this->db_onedev); exit; } $sql = "select M_KelurahanID as id, M_KelurahanName as name from m_kelurahan where M_KelurahanIsActive = 'Y' and M_KelurahanName like ?"; $query = $this->db_onedev->query($sql, array($q['search'])); if ($query) { $rows = $query->result_array(); $result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows)); $this->sys_ok($result); } else { $this->sys_error_db("m_kelurahan rows",$this->db_onedev); exit; } } }