Guestbook

connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT g_name, g_message FROM guestbook"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo'Name: '.htmlspecialchars($row["g_name"]); echo'
'; echo'Message: '.htmlspecialchars($row["g_message"]); echo'
'; echo'_______'; echo'
'; } } else { echo "

Be the first to write something here!

"; } $conn->close(); ?>