Country Database

[insert_php]

$connection = mysql_connect(“localhost”,”mijnlieff_elbruz”,”c4MOyRfj”) or die (“Couldn’t connect to the database”);
$db = mysql_select_db(“mijnlieff_elbruz”) or die (“Couldn’t select database”);

if (isset($_GET[‘id’]))
{

$sql = “SELECT Id, Name, Latdeg, Latsec, WindLa, LonDeg, LonSec, WindLo, ISO2, ISO3, FIPS10_4, IOC, LPO, DNS, LocalName, ISO, PhoneCode, LowElev, LowElevDescr, HighElev, HighElevDescr, Coastline, Timezone, Area, LandArea, WaterArea, from_day, from_month, from_year, acbc from country where Id=\”{$_GET[‘id’]}\””;
$sql_result = mysql_query($sql,$connection) or die (“Couldn’t execute query”);

$myrow = mysql_fetch_array($sql_result);
$FipsCode =strtolower($myrow[FIPS10_4]);
$kaart = “http://{$_SERVER[‘HTTP_HOST’]}/content/maps/” . $FipsCode . “-150.gif”;
$vlag = “http://{$_SERVER[‘HTTP_HOST’]}/content/flags/” . strtolower($myrow[ISO2]) . “.gif”;

$sql=”SELECT name FROM country, border WHERE border.countryISO3 = \”$myrow[ISO3]\” AND country.ISO3 = border.borderCountryISO3 ORDER BY name”;
$buurlanden = mysql_query($sql,$connection) or die (“Couldn’t execute query”);

echo ”

$myrow[Name] ($myrow[LocalName])























Name$myrow[Name]
LocalName$myrow[LocalName]
Independent since $myrow[from_year] / $myrow[from_month] / $myrow[from_day] ($myrow[acbc])
Capital(s)“;

$sql2 = “SELECT Capital, Remarks from capital where Id=\”$id\” “;
$sql_result2 = mysql_query($sql2,$connection) or die (“Couldn’t execute query”);
while ($myrow2 = mysql_fetch_array($sql_result2))
{
echo “$myrow2[Capital] $myrow2[Remarks]\n”;
}
echo “

Currency“;
$sql3 = “SELECT Currency, Code from currency where Id=\”$id\” “;
$sql_result3 = mysql_query($sql3,$connection) or die (“Couldn’t execute query”);
while ($myrow3 = mysql_fetch_array($sql_result3))
{
echo “$myrow3[Currency] ($myrow3[Code])\n”;
}
$AltDiff = $myrow[HighElev] – $myrow[LowElev];
if ($myrow[Area] >0) {$Steepness = round($AltDiff / $myrow[Area] * 1000);} else $Steepness = 0;
if ($myrow[LandArea] > 0) {$Water = round($myrow[WaterArea] * 1000 / $myrow[LandArea]);} else $Water=0;
echo “
ISO2$myrow[ISO2]
ISO3$myrow[ISO3]
FIPS10 4$myrow[FIPS10_4]
IOC$myrow[IOC]
LPO$myrow[LPO]
DNS$myrow[DNS]
ISO$myrow[ISO]
Phone Code+ $myrow[PhoneCode]
TimezoneGMT $myrow[Timezone]
Land Area$myrow[LandArea] sq km
Water Area$myrow[WaterArea] sq km
Coast line$myrow[Coastline] km
Lowest Point$myrow[LowElev] m ($myrow[LowElevDescr])
Highest Point$myrow[HighElev] m ($myrow[HighElevDescr])
Altitude Difference$AltDiff m
Steepness Coefficient$Steepness (1/1000m)
Water Coefficient$Water

Neighbouring countries “;
while ($buurland = mysql_fetch_array($buurlanden))
{
echo “$buurland[name], “;
}
echo “

“;
}

else

{

$sql = “SELECT Id, Name, status from country where status = 1 order by Name”;
$sql_result = mysql_query($sql,$connection) or die (“Couldn’t execute query”);
$number = mysql_num_rows($sql_result);

echo “As we speak there are $number EZ certified countries”;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo ““;
echo “
“;
echo “
“;
echo ““;
echo “
“;
echo “

“;
echo ”

“;
}
[/insert_php]