-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
49 lines (37 loc) · 1.57 KB
/
Copy pathpost.php
File metadata and controls
49 lines (37 loc) · 1.57 KB
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
44
45
46
47
48
49
<?php include "inc/header.php";?>
<?php
if (!isset($_GET['id']) || $_GET['id'] == NULL ) {
header("Location:404.php"); }else{
$id = $_GET['id'];
}
?>
<div class="contentsection contemplete clear">
<div class="maincontent clear">
<?php
$query ="select * from tbl_post where id=$id";
$post = $db->select($query);
if ($post) {
while ($result = $post->fetch_assoc()) {
?>
<div class="about">
<h2><a href="post.php?id=<?php echo $result['id'];?>"><?php echo $result['title'];?> </a></h2>
<h4><?php echo $fm->formateDate($result['date']); ?> By <a href="#"><?php echo $result['author'];?></a></h4>
<a href="#"><img src="admin/upload/<?php echo $result['image'];?>" alt="post image" /></a>
<?php echo $result['body'];?>
<div class="relatedpost clear">
<h2>Related articles</h2>
<?php
$catid=$result['cat'];
$queryrelated ="select * from tbl_post where cat=$catid limit 6";
$relatedpost = $db->select($queryrelated);
if ($relatedpost) {
while ($rresult = $relatedpost->fetch_assoc()) {
?>
<a href="post.php?id=<?php echo $rresult['id'];?>">
<img src="admin/upload/<?php echo $rresult['image']; ?>" alt="post image" height="140px";/></a>
</div>
</div>
<?php } } else{echo "Relative post not found";}?>
<?php } } else{header("Location:404.php");}?>
</div>
<?php include "inc/footer.php";?>