Customer Reviews
prepare("INSERT INTO blogcomments (news_id, name, email, comment) VALUES (?, ?, ?, ?)"); $stmt->bind_param("isss", $id, $name, $email, $comment); $stmt->execute(); echo "

✅ Comment added successfully!

"; } else { echo "

❌ Please fill all fields.

"; } } // --- Fetch and display existing comments --- ?> prepare("SELECT name, comment, created_at FROM blogcomments WHERE news_id = ? ORDER BY created_at DESC"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { echo "
"; while ($comment_row = $result->fetch_assoc()) { $name = htmlspecialchars($comment_row['name']); $date = date("F d, Y", strtotime($comment_row['created_at'])); $comment = nl2br(htmlspecialchars($comment_row['comment'])); echo "
avatar
{$name}

{$date}

{$comment}

"; } echo "
"; } else { echo "

No comments yet. Be the first to comment!

"; } $stmt->close(); ?>
Add A Review

Your email address will not be published