prepare('SELECT t.*, u.username FROM discussion_threads t JOIN users u ON t.user_id = u.id WHERE t.id = ?'); $stmt->execute([$thread_id]); $thread = $stmt->fetch(); if (!$thread) { header('Location: forums.php'); exit(); } // Fetch posts in this thread $stmt = $pdo->prepare( 'SELECT p.*, u.username FROM discussion_posts p JOIN users u ON p.user_id = u.id WHERE p.thread_id = ? ORDER BY p.created_at ASC' ); $stmt->execute([$thread_id]); $posts = $stmt->fetchAll(); ?>

Started by on


No replies yet.


Post a Reply