-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebar.php
More file actions
56 lines (51 loc) · 2.18 KB
/
sidebar.php
File metadata and controls
56 lines (51 loc) · 2.18 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
50
51
52
53
54
55
56
<div id="sidebar" class="col-md-4">
<!-- search box -->
<div class="search-box-container">
<h4>Search</h4>
<form class="search-post" action="search.php" method ="GET">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search .....">
<span class="input-group-btn">
<button type="submit" class="btn btn-danger">Search</button>
</span>
</div>
</form>
</div>
<!-- /search box -->
<!-- recent posts box -->
<div class="recent-post-container">
<h4>Recent Posts</h4>
<?php
include 'common.php';
$limit = 6;
$sql = "select * from post "
. "left join category on post.category = category.category_id "
. "order by post.post_id desc limit {$limit} ";
$result = mysqli_query($conn,$sql) or die("query failed");
if(mysqli_num_rows($result)>0){
while ($row = mysqli_fetch_assoc($result)){
?>
<div class="recent-post">
<a class="post-img" href="single.php?id=<?php echo $row['post_id']; ?>">
<img src="admin/upload/<?php echo $row['post_img'];?>" alt=""/>
</a>
<div class="post-content">
<h5><a href="single.php?id=<?php echo $row['post_id']; ?>"><?php echo $row['title'];?></a></h5>
<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-calendar" aria-hidden="true"></i>
<?php echo $row['post_date'];?>
</span>
<a class="read-more" href="single.php?id=<?php echo $row['post_id']; ?>">read more</a>
</div>
</div>
<?php
}
}
?>
</div>
<!-- /recent posts box -->
</div>