public function getDistrictByCity() { $city = Generic::mustCheck($_GET['city'], "City Required"); $city = urldecode(strtoupper($city)); if ($city == "-1") { Generic::errorMsg("Please Select City"); } $getAll = $city == "0"; $l = new LocationModel(); $arrLoc = $getAll ? $l->getAll() : $l->getWhere("city='{$city}' ORDER BY district ASC"); $arrDistricts = array(); foreach ($arrLoc as $loc) { unset($b); $b['value'] = $loc->district; $b['text'] = $loc->district; $arrDistricts[] = $b; } $results['district'] = $arrDistricts; $u = new UserModel(); $arrUser = $getAll ? $u->getWhere("last_city!=''") : $u->getWhere("last_city='{$city}'"); $userIds = array(); foreach ($arrUser as $user) { $userIds[] = $user->id_user; } $results['user_count'] = count($arrUser); $results['user_ids'] = implode(',', $userIds); Generic::finish($results); }