prepare("INSERT INTO posts (title, content, author, slug) VALUES (?, ?, ?, ?)"); $stmt->execute([$title, $content, $author, $slug]); $message = '
Post created successfully!
'; } catch (PDOException $e) { $message = '
Error: ' . $e->getMessage() . '
'; } } else { $message = '
Please fill in all fields.
'; } } ?>

Add New Post Logout


Manage Posts

query("SELECT id, title, author, created_at FROM posts ORDER BY created_at DESC"); $posts = $stmt->fetchAll(); if ($posts) { foreach ($posts as $post) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ''; echo ""; } } else { echo ''; } } catch (PDOException $e) { echo ''; } ?>
# Title Author Created At Actions
" . htmlspecialchars($post['id']) . "" . htmlspecialchars($post['title']) . "" . htmlspecialchars($post['author']) . "" . date("F j, Y, g:i a", strtotime($post['created_at'])) . " View Edit Delete
No posts found.
Error: ' . $e->getMessage() . '