-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsingle.php
68 lines (53 loc) · 2.39 KB
/
single.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php include 'header.php'; ?>
<div id="main-content">
<div class="container">
<div class="row">
<div class="col-md-8">
<!-- post-container -->
<?php
include "admin/config.php";
$post_id = $_GET['id'];
$query = "SELECT post.post_id, post.title, post.description,post.post_img, post.post_date,post.category, category.category_name,user.username,post.author FROM post
LEFT JOIN category ON post.category = category.category_id
LEFT JOIN user ON post.author = user.user_id
WHERE post.post_id = {$post_id}";
$result = mysqli_query($connection,$query) or die("Failed");
$count = mysqli_num_rows($result);
if($count > 0){
while($row = mysqli_fetch_assoc($result)){
?>
<div class="post-container">
<div class="post-content single-post">
<h3><?php echo $row['title'] ?></h3>
<div class="post-information">
<span>
<i class="fa fa-tags" aria-hidden="true"></i>
<a href="category.php?cid=<?php echo $row['category'] ?>"><?php echo $row['category_name'] ?></a>
</span>
<span>
<i class="fa fa-user" aria-hidden="true"></i>
<a href='author.php?author_id=<?php echo $row['author'] ?>'><?php echo $row['username'] ?></a>
</span>
<span>
<i class="fa fa-calendar" aria-hidden="true"></i>
<?php echo $row['post_date'] ?>
</span>
</div>
<img class="single-feature-image" src="admin/upload/<?php echo $row['post_img'] ?>" alt=""/>
<p class="description">
<?php echo $row['description'] ?>
</p>
</div>
</div>
<?php }
}else{
echo "No Record Found.";
}
?>
<!-- /post-container -->
</div>
<?php include 'sidebar.php'; ?>
</div>
</div>
</div>
<?php include 'footer.php'; ?>