forked from hung1605/student_manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent_view.php
57 lines (52 loc) · 1.6 KB
/
student_view.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
<?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'];
$gpa = getStudentGPA($student_id);
$classmates = getClassmates($student_id);
?>
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h2 class="card-title noi-bat">Your GPA</h2>
</div>
<div class="card-body">
<p class="card-text noi-bat">Your GPA is: <?php echo (int)$gpa; ?></p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h2 class="card-title noi-bat">Your Classmates</h2>
</div>
<div class="card-body">
<?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>
</div>
</div>
</div>
</div>
<?php include 'templates/footer.php'; ?>