-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
42 lines (32 loc) · 1.16 KB
/
search.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
<?php include 'inc/header.php'; ?>
<?php include 'inc/slider.php'; ?>
<?php
if(!isset($_GET['search']) || $_GET['search'] == NULL){
header("Location:404.php");
}else{
$search = $_GET['search'];
}
?>
<div class="contentsection contemplete clear">
<div class="maincontent clear">
<?php
$query = "select * from tbl_post where title LIKE '%$search%' OR body LIKE '%$search%'";
$post = $db->select($query);
if ($post) {
while ($result = $post->fetch_assoc()) {
?>
<div class="samepost clear">
<h2><a href=" post.php?id=<?php echo $result['id'];?>"><?php echo $result['title'];?></a></h2>
<h4><?php echo $fm->formatDate($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 $fm->textShorten($result['body']); ?>
<div class="readmore clear">
<a href = "post.php?id=<?php echo $result['id']; ?>">Read More</a>
</div>
</div>
<?php } } else { ?>
<p> Not Found...!!! </p>
<?php } ?>
</div>
<?php include 'inc/sidebar.php'; ?>
<?php include 'inc/footer.php'; ?>