The truth is I'm starting on this php and I have no idea why this error, I try to display the values of my database in a table and I get this
Notice: Trying to get property 'num_rows' of non-object in C: \ xampp \ htdocs \ Panel \ index.php on line 36
<?php
$conn = mysqli_connect("localhost", "root", "");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM mensajes";
$result = $conn->query($sql);
if ($result-> num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["id"]. "</td><td>" . $row["nombre"] . "</td><td>"
. $row["email"]. "</td></tr>";
}
echo "</table>";
} else { echo "0 results"; }
$conn->close();
?>