-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_show.php
43 lines (40 loc) · 864 Bytes
/
post_show.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
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if(filter_input_array(INPUT_GET)){
$id = filter_input(INPUT_GET, "id");
$post = find_post($id);
}else{
//post not found
//redirect to index with error message
}
error_reporting(0);
include "includes/header.inc";
?>
<div id="content">
<ul id="subnav">
<li><a href="post_index.php">Post Index</a></li>
<li><a href="post_new.php">New Post</a></li>
</ul>
<?php
print_post($post['title'], $post['body']);
?>
</div>
<?php
include "includes/footer.inc";
?>
<?
function print_post($title, $body){ ?>
<div class="blog">
<h2><?=$title?></h3>
<p><?=$body?></p>
<p><?=$status?></p>
</div>
<?}
function find_post($id){
include "includes/db_con.inc";
$conn = conDB();
$query = "SELECT * FROM posts where posts.id = '".$id."'";
$result = q($query);
$post = mysql_fetch_array($result);
return $post;
}
?>