Hello,
I hope all of you are safe with your families.
Currently I am starting with PHP Coding and I am trying to do a simple query to MySQL DB using PHP but even when is able to bring the number of rows is not displaying the values in the DB.
This is my code:
<?php
$servername = "localhost";
$database = "mydbtest";
$username = "root";
$password = "root";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully";
$myquery = "SELECT * FROM Country";
$result = $conn->query($myquery);
$numf = $result->num_rows;
echo "Number of rows " . $numf . "<br>";
if($numf >0){
while($row = $result->fetch_object()){
echo "Code" . $row->countrycode . "<br>";
echo "Country" . $row->countryname . "<br>";
}
}else{
echo '0 results';
}
mysql_free_result($myout);
mysqli_close($conn);
?>
What is failing?
Thanks in advance for the assistance.