-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_results.php
More file actions
48 lines (43 loc) · 1.25 KB
/
view_results.php
File metadata and controls
48 lines (43 loc) · 1.25 KB
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
<?php
include("db_connection.php");
// Fetch results with student name and quiz title
$result = mysqli_query($conn,
"SELECT r.result_id, s.name AS student_name, s.email, z.quiz_title, r.score
FROM result r
JOIN student s ON r.student_id = s.student_id
JOIN quiz z ON r.quiz_id = z.quiz_id
ORDER BY r.result_id DESC"
);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Results</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>All Student Results</h2>
<table border="1" cellpadding="10">
<tr>
<th>ID</th>
<th>Student Name</th>
<th>Email</th>
<th>Quiz Title</th>
<th>Score</th>
</tr>
<?php while($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $row['result_id']; ?></td>
<td><?php echo $row['student_name']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['quiz_title']; ?></td>
<td><?php echo $row['score']; ?></td>
</tr>
<?php } ?>
</table>
<br>
<a href="index.php">Back to Home</a>
</body>
</html>