prepare("INSERT INTO forum_posts (thread_id, author, body) VALUES (:thread_id, :author, :body)"); $stmt->execute([ ':thread_id' => $id, ':author' => $author, ':body' => $body, ]); header('Location: thread.php?id=' . $id . '&posted=1'); exit; } } $stmt = $pdo->prepare("SELECT * FROM forum_threads WHERE id = :id"); $stmt->execute([':id' => $id]); $thread = $stmt->fetch(); if (!$thread) { $pageTitle = 'Thread Not Found'; } $posts = []; if ($thread) { $stmt = $pdo->prepare("SELECT * FROM forum_posts WHERE thread_id = :id ORDER BY created_at DESC"); $stmt->execute([':id' => $id]); $posts = $stmt->fetchAll(); } include __DIR__ . '/includes/header.php'; ?>
Started by = h($thread['author']) ?> ยท = h(format_date($thread['created_at'])) ?>
= nl2br(h($thread['body'])) ?>
No replies yet. Be the first to respond.
= h($post['body']) ?>