executeQuery($state_query, []); if ($state_result === false) { show_pdo_error($state_query, $wrapperObj->getLastStatement()); } foreach ($state_result as $RowData) { if ($case=='lowercase') { $stateArr[$RowData['id']] = strtolower($RowData['name']); } else { $stateArr[$RowData['id']] = $RowData['name']; } } return $stateArr; } public static function get_countries($key='', $case='', $wrapperObj) { $countryArr = array(); $country_query = "SELECT id, name, abbrivation FROM country ORDER BY name"; $country_result = $wrapperObj->executeQuery($country_query, []); if ($country_result === false) { show_pdo_error($country_query, $wrapperObj->getLastStatement()); } foreach ($country_result as $RowData) { if ($case=='lowercase') { $RowData['name'] = strtolower($RowData['name']); $RowData['abbrivation'] = strtolower($RowData['abbrivation']); } if ($key=='name') { $countryArr[$RowData['name']] = $RowData['id']; } else if($key=='code') { $countryArr[$RowData['abbrivation']] = $RowData['id']; } else { $countryArr[$RowData['id']] = $RowData['name']; } } return $countryArr; } } ?>