-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.php
30 lines (19 loc) · 652 Bytes
/
post.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include 'includes/header.php';
?>
<?php
//ID Variable from the URL at the action href
$id = $_GET['id'];
//Create Database
$db = new Database();
//Create Query
$query= "SELECT * FROM posts WHERE id =".$id;
//Run Query
$post= $db-> select ($query)->fetch_assoc();
?>
<div class="blog-post">
<h2 class="blog-post-title"><?php echo $post['title']; ?></h2>
<p class="blog-post-meta"><?php echo formatDate($post['timestamp']); ?> by <a href="#"><?php echo $post['author']; ?></a></p>
<?php echo $post['body']; ?>
</div>
<?php include 'includes/footer.php' ?>