This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
summary.php
68 lines (60 loc) · 1.6 KB
/
summary.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order Summary</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<style>
.platos-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.platos-table th, .platos-table td {
border: 1px solid #dee2e6;
padding: 8px;
}
.platos-table th {
background-color: #007bff;
color: white;
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center">Summary</h1>
<?php
$servername = "localhost";
$username = "tekhmos";
$password = "Tekhmos12";
$dbname = "BadDays";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Cant connect to DBMS: " . $conn->connect_error);
}
$room_code = $_GET['room_code'];
$sql = "SELECT pl.numero_plato, SUM(p.cantidad_pedido) AS cantidad_total
FROM platos pl
INNER JOIN pedidos p ON pl.plato_id = p.plato_id
WHERE pl.room_code = '$room_code'
GROUP BY pl.numero_plato";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table class='platos-table'>";
echo "<tr><th>Item Number</th><th>Total Quantity</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>".$row["numero_plato"]."</td>";
echo "<td>".$row["cantidad_total"]."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<p>No orders found yet.</p>";
}
$conn->close();
?>
</div>
</body>
</html>