Im trying to make a table be displayed out into the browser i have added data to my database and used the following code include_once 'dbh.inc.php';
$list = "SELECT * FROM users";
$results = mysqli_query($conn, $list);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"]. " - listing: " . $row["address"]. " " . $row["type"]. "<br>";
}
} else {
echo "0 results";
}
but I always get 0 results, and no errors Im not sure what is wrong (the database is populated and there is a db connection).