From 7d9cbb1b69775b1adef44cf01c680d50482c1052 Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Wed, 6 Aug 2025 10:51:52 +0700 Subject: [PATCH] Update Country, menambahkan method get untuk pencarian nama country --- app/Controllers/Country.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Country.php b/app/Controllers/Country.php index 690f8e4..4fe474b 100644 --- a/app/Controllers/Country.php +++ b/app/Controllers/Country.php @@ -13,7 +13,16 @@ class Country extends Controller { public function index() { try { - $sql = "select * from country"; + + $Country = $this->request->getVar('Country'); + + if ($Country != null) { + $filterQuery = " WHERE Country LIKE '%$Country%'"; + } else { + $filterQuery = ""; + } + + $sql = "SELECT IntCountryID, CountryID, Country FROM country $filterQuery"; $data = $this->db->query($sql)->getResultArray(); return $this->respond([