<title>World Database List Small Countries</title>
<h3>World Database Small Countries</h3>
// Open the Database, selecting the World2 database
$con = mysqli_connect("localhost","demo","demo","world2");
if (!$con)
    die("Could not connect: " . mysqli_error($con));

$maxpop = 100000;  // Largest country to include

echo "<h4>List countries with less than ".Smaxpop." people</h4>";

$query = "SELECT * FROM `Country` WHERE `Population` <= ".$maxpop." ORDER BY `Po

echo $query."<br>";

//Lookup the matches
$result = mysqli_query($con,$query);

//Check if there was a match
if (!$result) {
   die("No countries <= ".$maxpop);
//Display the results
echo "<table border=1>";
echo "<tr><th>Country</th><th>Continent</th>
while ($Row=mysqli_fetch_assoc($result)) {
   echo "<tr><td>{$Row['Name']}</td>";
   echo "<td>{$Row['Continent']}</td>";
   echo "<td>{$Row['Region']}</td>";
   echo "<td>{$Row['Population']}</td></tr>";
echo "</table>";


<div id="_mcePaste"><input type="button" value="New search" onClick="parent.location='countrymenu.php'"</div>

Topic revision: r1 - 2013-11-22 - JimSkon
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback