I'm trying to use php to display all the comments added to a form but it's only giving me the first row. Any idea why this is happening?
<?php
echo "Comments page";
$conn = new mysqli('localhost', 'comment42_user', 'test42', 'comments');
$result = $conn->query("SELECT fname, lname, email, website, comment FROM comments;");
$row = $result->fetch_assoc();
echo "First name:" . $row['fname'];
echo " last name:" . $row['lname'];
echo " Email:" . $row['email'];
echo " Website:" . $row['website'];
echo " comment:" . $row['comment'];
?>
Aucun commentaire:
Enregistrer un commentaire