I'm very new to MySQL, and I'm having some trouble echoing the values from a table. For the code I have here, the output is totally blank. Where am I going wrong? Is it with the loop?
<?php
$a = 1;
$b = 2;
$con = mysqli_connect ();
//Check Connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$table = "CREATE TABLE info (id INT NOT NULL AUTO_INCREMENT, city CHAR(40), country CHAR(40))" or die(mysql_error());
$table = mysqli_query($con, "INSERT INTO info (city, country) VALUES ($a, $b)) or die(mysql_error()") or die(mysql_error());
$result = mysqli_query("SELECT * FROM info") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo $row['city'];
}
mysqli_close($con);
?>