-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
158 lines (151 loc) · 6.15 KB
/
search.php
File metadata and controls
158 lines (151 loc) · 6.15 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
session_start();
include "connect.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sabka Dukan</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/animate.min.css" rel="stylesheet" type="text/css" media="all" /><!-- animation -->
<link href="css/menu.css" rel="stylesheet" type="text/css" media="all" /> <!-- menu style -->
<!-- //Custom Theme files -->
<!-- font-awesome icons -->
<link href="css/font-awesome.css" rel="stylesheet">
<!-- //font-awesome icons -->
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/jquery-scrolltofixed-min.js" type="text/javascript"></script><!-- fixed nav js -->
<script>
$(document).ready(function() {
// Dock the header to the top of the window when scrolled past the banner. This is the default behaviour.
$('.header-two').scrollToFixed();
// previous summary up the page.
var summaries = $('.summary');
summaries.each(function(i) {
var summary = $(summaries[i]);
var next = summaries[i + 1];
summary.scrollToFixed({
marginTop: $('.header-two').outerHeight(true) + 10,
zIndex: 999
});
});
});
</script>
<!-- //js -->
<!-- web-fonts -->
<link href='//fonts.googleapis.com/css?family=Roboto+Condensed:400,300,300italic,400italic,700,700italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Lovers+Quarrel' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Offside' rel='stylesheet' type='text/css'>
<!-- web-fonts -->
<!-- start-smooth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
</script>
<!-- //end-smooth-scrolling -->
<!-- smooth-scrolling-of-move-up -->
<script type="text/javascript">
$(document).ready(function() {
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
<!-- //smooth-scrolling-of-move-up -->
</head>
<body>
<!-- header -->
<div class="header">
<div class="w3ls-header"><!--header-one-->
<div class="w3ls-header-right">
<ul>
<?php if(isset($_SESSION['id'])){ ?>
<li class="dropdown head-dpdn">
<a href="customer/dashboard.php" class="dropdown-toggle">Dashboard</a>
</li>
<li class="dropdown head-dpdn">
<form action="auth/signout.php" method="post">
<button class="dropdown-toggle" style="background-color: Transparent;background-repeat:no-repeat; border: none; cursor:pointer; overflow: hidden; outline:none; color:white">Sign Out</button>
</form>
</li>
<?php } else { ?>
<li class="dropdown head-dpdn">
<a href="auth/login.php" class="dropdown-toggle">Login</a>
</li>
<li class="dropdown head-dpdn">
<a href="auth/signup.php" class="dropdown-toggle">Sign Up</a>
</li>
<?php }; ?>
</ul>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- header -->
<div class="container" style="margin-top: 40px; margin-bottom: 40px">
<h3>Search Result for <b><?php echo $_GET['search'] ?></b></h3>
</div>
<div class="container">
<?php
$search_word = preg_split("/\s+/", $_GET['search']);
$query = "SELECT * FROM ".$product_table." WHERE UPPER(PName) LIKE UPPER('%".$search_word[0]."%')";
for($i = 1; $i < count($search_word); $i++) {
$query .= " OR UPPER(PName) LIKE UPPER('%".$search_word[$i]."%')";
}
// echo $query;
$result = $conn->query($query);
$result2 = $conn->query($query);
?>
<div class="products-row">
<?php
while($row = $result->fetch_assoc()){
?>
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4"><a href="<?php echo 'single.php?id='.$row['ProductID'] ?>"><img src="<?php echo "images/".$row['Picture'] ?>" class="img-responsive" alt="img"></a></div>
<div class="col-lg-4 col-md-8">
<a href="<?php echo "single.php?id=".$row['ProductID'] ?>"><h2><?php echo $row["PName"] ?></h2></a></br>
<span><h4><del>$<?php echo intval($row["Cost"]*100)/100 ?></del> $<?php echo intval(($row["Cost"]- ($row["Cost"]*$row["Discount"])/100)*100)/100 ?></h4> </span></br>
</div>
</div>
</div>
</div>
<?php
};
$row = $result->fetch_assoc();
if($row == ""){
echo "<h1>No search result is found for the given key word.</h1>";
echo "Return to <a href='.'>Home</a> Page";
}
?>
</div>
</div>
<!-- menu js aim -->
<script src="js/jquery.menu-aim.js"> </script>
<script src="js/main.js"></script> <!-- Resource jQuery -->
<!-- //menu js aim -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/bootstrap.js"></script>
</body>
</html>