exec($sql); // Check if posts table is empty $stmt = $pdo->query("SELECT COUNT(*) FROM posts"); $postCount = $stmt->fetchColumn(); if ($postCount == 0) { $posts = [ [ 'title' => 'The Future of Web Development', 'content' => 'The web is constantly evolving. In this post, we explore the latest trends in web development, from serverless architectures to the rise of AI-powered tools. Stay ahead of the curve and learn what to expect in the coming years.', 'author' => 'Jane Doe' ], [ 'title' => 'A Guide to Mindful Coding', 'content' => 'Coding can be stressful. This guide offers practical tips for staying focused, managing complexity, and writing better code through mindfulness. Learn how to bring a sense of calm and clarity to your development process.', 'author' => 'John Smith' ], [ 'title' => 'Mastering CSS Grid', 'content' => 'CSS Grid is a powerful tool for creating complex layouts with ease. This tutorial walks you through the fundamentals of Grid, with practical examples and pro tips to help you master this essential CSS feature.', 'author' => 'Emily White' ] ]; $stmt = $pdo->prepare("INSERT INTO posts (title, content, author) VALUES (?, ?, ?)"); foreach ($posts as $post) { $stmt->execute([$post['title'], $post['content'], $post['author']]); } } } setup_database(); ?>