-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquerysearch.php
54 lines (51 loc) · 1.2 KB
/
querysearch.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
<!DOCTYPE html>
<html>
<head>
<title>Query Search</title>
<link rel="stylesheet" type="text/css" href="css/responsive_styles.css">
</head>
<body>
<form action="querysearch.php" method="post">
<input type="text" name="query">
<input type="submit" name="querry" value="Submit">
</form>
</body>
</html>
<?php
include 'connect.php';
if(isset($_POST['querry']))
{
$query='';
$query=$_POST['query'];
$sql = "$query";
$result=mysqli_query($con,$sql) or die("Bad Query:$sql");
$num= mysqli_num_rows($result);
//echo $num;
if($num>0){
for($i=0;$i<3;$i++)
{
echo "<div class='main'>";
while($row=mysqli_fetch_assoc($result))
{
echo "<div class='container'>
<div class='box'>
<div class='img'>
<img src='img/{$row['pr_image']}'>
</div>
<div class='price'> ₹ {$row['pr_price']} <br><a href='#'><span style='font-size: 22px;'> Add to cart</span></a>
</div>
</div>
<div class='content'>
<div class='details'> {$row['pr_details']}
</div>
</div>
</div>";
}
echo "</div>";
}
}
else {
echo "Not found";
}
}
?>