real_escape_string(trim($_POST['comment'])); if (!empty($comment)) { $stmt = $conn->prepare("INSERT INTO comments (page_id, user_id, comment) VALUES (?, ?, ?)"); $stmt->bind_param("sss", $page_id, $user_id, $comment); if ($stmt->execute()) { header("Location: " . $_SERVER['REQUEST_URI']); exit; } } } // Fetch comments $stmt = $conn->prepare("SELECT user_id, comment, created_at FROM comments WHERE page_id = ? ORDER BY created_at DESC"); $stmt->bind_param("s", $page_id); $stmt->execute(); $result = $stmt->get_result(); ?>
Comments
fetch_assoc()): ?>
Author
MEMBER
'; } ?>