1$sql = "SELECT id, firstname, lastname FROM MyGuests";
2$result = $conn->query($sql);
3
4if ($result->num_rows > 0) {
5 // output data of each row
6 while($row = $result->fetch_assoc()) {
7 echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
8 }
9} else {
10 echo "0 results";
11}
12$conn->close();