-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
102 lines (85 loc) · 4.03 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
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
94
95
96
97
98
99
100
101
102
<?php
require "assets/db.php";
require "assets/varnames.php";
require 'assets/sharedComponents.php';
$components = new SharedComponents();
if(!isset($_GET["keywrd"]))
{
header("location: ./");
}
$keywrd = $_GET["keywrd"];
if($keywrd == "")
{
echo "<script>window.history.back()</script>";
}
include 'includes/header.php';
include 'includes/navbar.php';
$stmt = $conn->prepare("SELECT * FROM `article` INNER JOIN category ON id_categorie=category_id INNER JOIN author ON author_id=id_author WHERE article_status=1 AND article_title LIKE :keyword OR category_name LIKE :keyword OR author_fullname LIKE :keyword");
$stmt->bindValue(':keyword', '%' . $keywrd . '%', PDO::PARAM_STR);
$stmt->execute();
$searchdata = $stmt->fetchAll(PDO::FETCH_ASSOC);
$number_of_rows = $stmt->rowCount();
session_start();
?>
<!--section-heading-->
<div class="section-heading " >
<div class="container-fluid">
<div class="section-heading-2">
<div class="row">
<div class="col-lg-12">
<div class="section-heading-2-title text-left">
<h3>Search result(s) for : <?= $keywrd ?></h3>
<p class="desc"><?= $number_of_rows ?> Posts were found for keyword <strong><?= $keywrd ?></strong></p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--blog-layout-1-->
<div class="blog-search">
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 oredoo-content">
<div class="theiaStickySidebar">
<!--Post1-->
<?php foreach ($searchdata as $data) : ?>
<div class="post-list post-list-style1 pt-0">
<div class="post-list-image">
<a href="post-single.php?data=<?=substr($data['article_title'],0,30)."..."?>&id=<?= $components->protect($data['article_id']) ?>">
<img src="img/article/<?= $data['article_image'] ?>" alt="">
</a>
</div>
<div class="post-list-title">
<div class="entry-title">
<h5>
<a href="post-single.php?data=<?=substr($data['article_title'],0,30)."..."?>&id=<?= $components->protect($data['article_id']) ?>">
<?php //echo strlen($article['article_title']) > 57 ? substr($article['article_title'],0,57)."..." : $article['article_title']; ?>
<?= $data['article_title'] ?>
</a>
</h5>
</div>
</div>
<div class="post-list-category">
<div class="entry-cat">
<a href="category.php?data=<?=substr($data['category_name'],0,30)."..."?>&catID=<?= $components->protect($data['category_id']) ?>" class="category-style-1" style="color:<?= $data['category_color'] ?>">
<?= $data['category_name'] ?>
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<!--sidebar-->
<?php
include 'includes/sidebar.php';
?>
<!--/-->
</div>
</div>
</div>
<?php
include 'includes/footer.php';
include 'includes/scripts.php';
?>