-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearch-Display.php
88 lines (82 loc) · 2.66 KB
/
Search-Display.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Products Page</title>
<link rel="stylesheet" href="index.css">
<style media="screen">
.Search{
margin:2%;
}
</style>
</head>
<body>
<div class="header">
<div id="page-title">
<button type="button" name="home-button" id="home-button" onclick="document.location.href='index.php'"></button>
<div class="Account">
<?php
session_start();
if(isset($_SESSION['uid'])){
echo $_SESSION['username'].
"<br><button class='buttons' onclick=\"window.location.href='logout.php'\">Logout</button>";
}
?>
</div>
<h1>BeSanta : Donation System</h1>
<p class="slogan">Let's be someone's Santa!</p>
</div>
</div>
<div class="main-container">
<br>
<div class="Search">
<label>Search </label>
<input type="search" name="search-bar" value="" placeholder="search your products here" style="width:20%;">
<input type="submit" name="search-submit" value="🔍" style="border:0px; background-color:inherit;">
</div>
<div class="Product-list">
<h2>Search result...</h2>
<?php
$conn = mysqli_connect('localhost','root','','donationsystem');
if($conn){
//echo "Connection successful";
//die("Connection Failed : ". $conn->connect_error);
$query = "select * from items";
$result = $conn->query($query);
if($result->num_rows > 0)
{
while($row = $result->fetch_assoc()){
echo "<div class='item-block'>".
$row["item_name"]."<br>".
$row["category"]."<br>".
$row["brand"]."<br>".
$row["quantity"]."<br>".
$row["item_weight"]."<br>"
."</div>";
/*echo
"<tr>".
"<td>".$row["ProjectID"]."</td>".
"<td>".$row["Project_Title"]."</td>".
"<td>".$row["StartDate"]."</td>".
"<td>".$row["EndDate"]."</td>".
"<td>".$row["Project_status"]."</td>".
"<td>".$row["technologies"]."</td>".
"<td>".$row["projectClient"]."</td>".
"</tr>";
}
echo "</table>";*/
}
}
else{
echo "No items available";
}
}
else{
echo "Connection Failed!";
}
$conn->close();
?>
</div><br>
</div>
</body>
</html>