You are here

function countries_api_get_list in Country codes API 5

Same name and namespace in other branches
  1. 6 countries_api.module \countries_api_get_list()

Function to return an associative array of all countries. TODO: Cache results

Return value

associative array of all countries

3 calls to countries_api_get_list()
CountriesApiTest::test_countries_api_get_list in tests/countries_api.test
Function to validate format (and presence of) countries from countries_api_get_list()
CountriesApiTest::test_count_countries_api_get_list in tests/countries_api.test
Function to validate length of countries list is greater than 0
countries_api_get_array in ./countries_api.module
Function to return an associative array of countries with key/values based on args Can be used to get results for FAPI form options.

File

./countries_api.module, line 229

Code

function countries_api_get_list() {
  $result = db_query("SELECT iso2, iso3, name, printable_name, numcode FROM {countries_api_countries}");
  $countries = array();
  while ($row = db_fetch_array($result)) {
    $countries[] = $row;
  }
  return $countries;
}