-
Notifications
You must be signed in to change notification settings - Fork 0
/
a-product-search.php
49 lines (49 loc) · 1.3 KB
/
a-product-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
<?php
$page_title = "a-product-search";
include("./config/constants.php");
include("./config/check_alogin.php");
?>
<style>
.employee{
display: none;
}
</style>
<table class="table">
<br>
<thead>
<tr>
<th scope="col">Image</th>
<th scope="col">Id</th>
<th scope="col">Name</th>
<th scope="col">Brand</th>
<th scope="col">Price</th>
<th scope="col">Discount</th>
<th scope="col">Final Price</th>
</tr>
</thead>
<tbody id="myTable">
<?php
if(isset($_POST['search'])){
$key_word = $_POST['search'];
$q = "SELECT * FROM product WHERE pname LIKE '%$key_word%' OR brand LIKE '%$key_word%'";
$res = mysqli_query($conn, $q);
while ($data = $res->fetch_assoc()) {
echo
"<tr>
<td><img src='".$data['img_src']."' height='48px' width='48px'/></td>
<td>".$data['pid']."</td>
<td>".$data['pname']."</td>
<td>".$data['brand']."</td>
<td>".$data['price']." $</td>
<td>".$data['discount']." %</td>
<td>".$data['fprice']." $</td>
</tr>";
}
}
else
{
header("location: home.php");
}
?>
</tbody>
</table>