-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
61 lines (58 loc) · 2.26 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
<!DOCTYPE html>
<html>
<?php
require_once('assets/head.php');
require_once('connection.php');
?>
<body>
<?php require_once('assets/header.php'); ?>
<div class="container">
<div class="row col-md-6">
<main>
<h1>Home</h1>
<article class="todays_exams">
<h2>Opkomende Examens</h2>
<?php
//Prepare and run a query
$getCalendar = $dbh->prepare("SELECT `calendar`.*, `user1`.`username` AS `docent1`, `user2`.`username` AS `docent2`, `student`.`first_name` AS `student_first_name`, `student`.`last_name` AS `student_last_name`
FROM `calendar`
LEFT JOIN `user` AS `user1`
ON user1.id = calendar.user_id_1
LEFT JOIN `user` AS `user2`
ON user2.id = calendar.user_id_2
LEFT JOIN `student`
ON student.id = calendar.student_id
WHERE DATE(date)=CURDATE()
ORDER BY date ASC, time ASC");
$getCalendar->execute();
$calendar = $getCalendar->fetchAll();
//Create the table
echo "<div class='table-responsive'>";
echo "<table class='table'>";
echo "<thead>";
echo "<tr>
<th>Naam</th>
<th>Examinatoren</th>
<th>Datum</th>
<th>Tijd</th>
</tr>";
echo "</thead>";
echo "<tbody>";
foreach( $calendar as $row) {
echo "<tr>";
echo "<td>".$row['student_first_name']." ".$row['student_last_name']."</td>";
echo "<td>".$row['docent1']."<span> & </span>".$row['docent2']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['time']."</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
?>
</article>
</main>
</div>
</div>
</body>
</html>