-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearchResults.php
More file actions
106 lines (92 loc) · 3.56 KB
/
searchResults.php
File metadata and controls
106 lines (92 loc) · 3.56 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
<?php
/**
* Created by PhpStorm.
* User: msbomrel
* Date: 11/29/16
* Time: 1:35 PM
*/
include ('include/connect.php');
if(isset($_POST['submit'])){
$search = $_POST['search'];
$query = "select * from category";
$results1 = mysqli_query($conn, $query) or die("Cannot connect");
$sql = "select id from category WHERE page_keyword LIKE '%$search%'";
$res = mysqli_query($conn, $sql);
if ($one = mysqli_fetch_array($res)) {
$i = $one['id'];
$sql1 = "select * from product where category_id = '$i'";
$results2 = mysqli_query($conn, $sql1) or die("dbms error");
}else{
$message = "Items not found";
}
}
?>
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<?php
include ('header.php');
?>
<!---- content box--->
<div class="ui main container">
<div class="ui grid">
<div class="three wide column">
<div class="ui vertical menu">
<a class="item">
<div class="header"><h3>Products Categories</h3></div>
</a>
<?php
while ($row = mysqli_fetch_assoc($results1))
{
?>
<a class="item" href="categoryDetails.php?id=<?php echo $row['id']; ?>" > <?php echo strtoupper($row['name']); ?> </a>
<?php } ?>
</div>
</div>
<div class="thirteen wide column">
<div class="ui fluid message">
<h3 style="align-self: flex-start">Featured Products <div style="float: right"> </div></h3>
<div class="ui three column grid"><br>
<h1><?php echo $message ?> </h1>
<?php
while ($row = mysqli_fetch_assoc($results2))
{
?>
<div class="column">
<div class="ui segment">
<a class="item">
<center>
<img src='product_images/<?php echo $row["prod_image"]?>'> <br>
<strong><?php echo mb_strtoupper($row["name"]);?></strong><br>
Price : Rs
<?php echo $row["price"];?><br>
<div class="ui vertical animated blue button" tabindex="0">
<div class="hidden content"> <a href="productDetails.php?id=<?php echo $row["id"]?>">Shop</a></div>
<div class="visible content">
<i class="shop icon"></i>
</div>
</div>
<div class="ui animated google button" tabindex="0">
<div class="hidden content"> <a href="productDetails.php?id=<?php echo $row["id"]?>">Details</a></div>
<div class="visible content">
<i class="content icon"></i>
</div>
</div>
</center>
</a>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<!----- footer------>
<?php
include('footer.php');
?>
</body>
</html>