Hello, I'm not able to display the whole select result information in the table and I have no idea what I am doing wrong, I would appreciate your help so much.
So here's my code:
<?php
$DBServer = 'localhost';
$DBUser = 'root';
$DBPass = '';
$DBName = 'world';
$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
$sql = "SELECT Id, Name, CountryCode, District, Population FROM city WHERE CountryCode = 'USA'";
$result = $conn->query($sql);
if($result->num_rows > 0){
echo "<table border='1'> <tr> <th>Id</th> <th>Name</th> <th>Code</th> <th>District</th> <th>Population</th> </tr>";
while($row = mysqli_fetch_array($result)){
echo"
<tr> <td>".$row['Id'] ."</td> <td>".$row['Name'] ."</td> <td>".$row['CountryCode'] ."</td> <td>".$row['District'] ."</td> <td>".$row['Population'] ."</td> </tr>
";
echo "</table><br>";
}
}else{
echo "No results";
}
$conn->close();
?>
This is how it looks like in the browser: http://prntscr.com/hty7m9 as you can see, only a one result is inside the table, I would like to be able to show every single result in the table.
Thanks.