-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistic_table.php
49 lines (43 loc) · 1.41 KB
/
statistic_table.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
require('connection.php');
require('header.php');
// Fetch the statistics data
$stmt = $conn->prepare("SELECT typeSoin.nomSoin, COUNT(appointments.id_appointment) AS appointmentCount
FROM typeSoin
LEFT JOIN appointments ON typeSoin.id_typeSoin = appointments.id_typeSoin
GROUP BY typeSoin.nomSoin");
$stmt->execute();
$statistics = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<title>Statistics</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h2 class="text-center mt-5">Appointment Statistics</h2>
<table class="table mt-4">
<thead>
<tr>
<th>Type Soin</th>
<th>Appointment Count</th>
</tr>
</thead>
<tbody>
<?php foreach ($statistics as $row) : ?>
<tr>
<td><?php echo $row['nomSoin']; ?></td>
<td><?php echo $row['appointmentCount']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="text-center">
<a href="Graph_Appointements.php" class="btn btn-primary mt-4">Graph</a>
</div>
</div>
</body>
</html>
<?php ?>