I am running some querys from my old users profiles and got stuck with one field labelled "country" the data is actually stored as a country number rather than a full alpha word.
When it comes to printing the result i get the country number obviously. So I need to convert these numbers into more meaningful words of each countries.
The following snipit of code I thought would work
Code:
<?php
include_once("countries.php");
?>
<?php
$countryX = array_flip($country);
$country_name = 'Yemen';
if (!$countryX[$country_name]){
$country_code = 169;
}
else {
$country_code = $countryX[$country_name];
}
echo ("<td BGCOLOR=#F7BDDE ALIGN=LEFT VALIGN=TOP>Country: ".$country[$country_code]."</td>\n");
?>
The external file would be like this
Code:
<?php $country = array ("1" => "Afghanistan", "2" => "Albania", "3" => "Algeria", "4" => "Andorra", "5" => "Angola", "6" => "Antigua and arbuda", "7" => "Argentina", "8" => "Armenia", "9" => "Australia",....."Yugoslavia", "166" => "Zaire", "167" => "Zambia", "168" => "Zimbabwe", "169" => "N/A");
?>
At present the country is printing N/A which means not available on on all my users list.
Name: Aditya
Age: 29 Years and 5 Months
************: Male
Country: N/A
Contact
Name: Tristan
Age: 17 Years and 1 Months
************: Male
Country: N/A
Contact
Name: AJ
Age: 21 Years and 11 Months
************: Male
Country: N/A
Contact
Name: Vince
Age: 18 Years and 11 Months
************: Male
Country: N/A
Contact
Some how the script is not displaying the full country.
any ideas?