-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
107 lines (86 loc) · 2.15 KB
/
index.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<style>
#customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #04AA6D;
color: white;
}
h1 {
font-size: 70px;
font-weight: 600;
background-image: linear-gradient(to left,#06c700, #000000);
color: transparent;
background-clip: text;
-webkit-background-clip: text;
text-align: center;
}
</style>
</head>
<body>
<h1>Digital Shemach</h1>
<?php
$con = mysqli_connect("localhost", "root", "", "DigitalShemacDataBase");
if (!$con) {
die('Could not connect: ' . mysqli_connect_error());
}
$result = mysqli_query($con, "SELECT cardID, UserName, Zeyit, Sukar, UsedDate FROM Information");
echo "<table id=\"customers\">
<thead>
<tr>
<th>Card ID</th>
<th>Name</th>
<th>Oil</th>
<th>Sugar</th>
<th>Date</th>
</tr>
</thead>";
echo "<tbody>";
while ($row = mysqli_fetch_array($result)) {
echo "<tr scope=\"row\">";
echo "<td>" . $row['cardID'] . "</td>";
echo "<td>" . $row['UserName'] . "</td>";
echo "<td>" . $row['Zeyit'] . "</td>";
echo "<td>" . $row['Sukar'] . "</td>";
echo "<td>" . $row['UsedDate'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
mysqli_close($con);
?>
</body>
</html>
<?php
/*
-- Create the table
CREATE TABLE Information (
id INT PRIMARY KEY AUTO_INCREMENT,
cardID CHAR(6),
UserName VARCHAR(255),
Zeyit VARCHAR(255),
Sukar VARCHAR(255),
UsedDate DATE
);
-- Insert sample data
INSERT INTO Information (cardID, UserName, Zeyit, Sukar, UsedDate)
VALUES
(CONV(FLOOR(RAND() * 16777215), 10, 16), 'John Doe', '5 L', '6 KG', '2021-10-01'),
(CONV(FLOOR(RAND() * 16777215), 10, 16), 'Jane Smith', '5 L', '3 KG', '2021-10-02'),
(CONV(FLOOR(RAND() * 16777215), 10, 16), 'Alice Johnson', '3 L', '8 KG', '2021-10-03');
*/
?>