forked from hung1605/student_manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classmates.php
36 lines (31 loc) · 969 Bytes
/
classmates.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
<?php
session_start();
if (!isset($_SESSION['loggedin']) || $_SESSION['role'] != 'student') {
header("Location: login.php");
exit();
}
include 'templates/header.php';
include 'functions/student_functions.php';
$student_id = $_SESSION['studentid'];
$classmates = getClassmates($student_id);
?>
<div class="container">
<h2>Your Classmates</h2>
<?php
if ($classmates->num_rows > 0) {
echo '<table class="table table-striped mt-3"><thead class="thead-dark"><tr><th>ID</th><th>Name</th><th>DOB</th><th>Address</th></tr></thead><tbody>';
while ($row = $classmates->fetch_assoc()) {
echo '<tr>
<td>' . $row['MaSV'] . '</td>
<td>' . $row['HoTen'] . '</td>
<td>' . $row['NgaySinh'] . '</td>
<td>' . $row['DiaChi'] . '</td>
</tr>';
}
echo '</tbody></table>';
} else {
echo '<p>No classmates found.</p>';
}
?>
</div>
<?php include 'templates/footer.php'; ?>