prepare("SELECT * FROM posts WHERE id = ?"); $stmt->execute([$post_id]); $post = $stmt->fetch(); } catch (PDOException $e) { error_log("DB Error: " . $e->getMessage()); } // If no post is found, redirect to the homepage if (!$post) { header("Location: index.php"); exit; } ?> <?php echo htmlspecialchars($post['title']); ?> - My Awesome Blog
My Awesome Blog

Posted on
Hero image for the blog post titled '<?php echo htmlspecialchars($post['title']); ?>'
← Back to all posts
© My Awesome Blog. All Rights Reserved.