Initial commit
This commit is contained in:
29
api-wiaas/server/components/v1/countries/CountriesModel.php
Normal file
29
api-wiaas/server/components/v1/countries/CountriesModel.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
class CountriesModel{
|
||||
/**
|
||||
* get the list of all countries
|
||||
* @return Array of countries
|
||||
*/
|
||||
public function getAllCountries($getArray = false){
|
||||
global $database;
|
||||
|
||||
$sql = "SELECT
|
||||
id,
|
||||
name
|
||||
FROM " . TABLES['countries']."
|
||||
ORDER BY name";
|
||||
|
||||
$countriesArray = $database->fetchResultArray($sql);
|
||||
|
||||
if($getArray) {
|
||||
return $countriesArray;
|
||||
}
|
||||
|
||||
foreach($countriesArray as $countryInfo) {
|
||||
$countries[$countryInfo['id']] = $countryInfo['name'];
|
||||
}
|
||||
|
||||
return $countries;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user