-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.php
93 lines (67 loc) · 3.19 KB
/
category.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php include "header.php"; ?>
<!-- Page Content -->
<!-- Banner Starts Here -->
<div class="main-banner header-text">
</div>
<!-- Banner Ends Here -->
<section class="blog-posts">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="all-blog-posts">
<div class="row">
<?php
$category =$_REQUEST['category'];
$sql = "SELECT * FROM posts WHERE
category_name LIKE '%$category%'";
$query = mysqli_query($conn,$sql);
$result = mysqli_num_rows($query );
if ($result>0) {
while ($row = mysqli_fetch_assoc($query)) {
$id = $row['posts_id'];
$posts_title = $row['posts_title'];
$posts_content = $row['posts_content'];
$posts_image = $row['posts_image'];
$category_name = $row['category_name'];
$tag_name = $row['tag_name'];
$author = $row['author'];
$created = $row['created_at'];
?>
<div class="col-lg-4">
<div class="blog-post">
<div class="blog-thumb">
<img src="admin/<?php echo $posts_image;?>" alt="<?php echo $posts_image;?>" >
</div>
<div class="down-content">
<span><a style="color:#f48840;" href="category.php?category=<?php echo $category_name;?>"><?php echo $category_name;?></a></span>
<a href="post-details.php?post=<?php echo $posts_title;?> "><h4><?php echo $posts_title;?></h4></a>
<ul class="post-info">
<li><a href="#"><?php echo $author;?></a></li>
<li><a href="#"><?php echo date( "d-M-Y", strtotime($created));?></a></li>
</ul>
<p><?php echo substr($posts_content,0,100)."...";?></p>
<div class="post-options">
<div class="row">
<div class="col-lg-12">
<ul class="post-tags">
<li><i class="fa fa-tags"></i></li>
<li><a href="tag.php?tag=<?php echo $tag_name;?>"><?php echo $tag_name;?></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } }
else {
echo "<h1>No data found</h1>";
}
?>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include "footer.php"; ?>