-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview_result.php
97 lines (82 loc) · 2.47 KB
/
view_result.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
include("connect.php");
doDB();
session_start();
if (!isset($_SESSION['id']) and !$_GET['quiz_id']) {
header("Location: student.php");
exit();
}
$students_sql = "SELECT distinct id FROM marks where quiz_id = '".$_GET['quiz_id']."'";
$students = mysqli_query($con, $students_sql) or die(mysqli_error($con));
$display_block = "
<table cellpadding = \"3\" cellspacing = \"1\" border = \"1\" align=\"center\" width=\"50%\">
<tr>
<th>Student</th>
<th>No of times attempted</th>
<th>Marks</th>
</tr>";
$nota =0;
while ($marks = mysqli_fetch_array($students)) {
$stud_id = $marks["id"];
$attempt = "SELECT count(*) as nota from marks where quiz_id = '".$_GET['quiz_id']."' and id='".$stud_id."'";
$attempt_res = mysqli_query($con, $attempt) or die(mysqli_error($con));
while ($no = mysqli_fetch_array($attempt_res)) {
$nota = $no["nota"];
}
$marks_sql = "SELECT MAX(marks) as hmarks FROM marks WHERE id = '".$stud_id."' and quiz_id='".$_GET['quiz_id']."'";
$attempt_res = mysqli_query($con, $marks_sql) or die(mysqli_error($con));
while ($hm = mysqli_fetch_array($attempt_res)) {
$marks = $hm["hmarks"];
}
$display_block .="
<tr>
<td align=\"center\">
".$stud_id."
</td>
<td align=\"center\">
".$nota."
</td>
<td align=\"center\">
".$marks."
</td>
</tr>
";
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Results</title>
<link rel="stylesheet" href="last.css">
<link href='https://fonts.googleapis.com/css?family=Alegreya Sans SC' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Merienda' rel='stylesheet'>
</head>
<h1> Marks </h1>
<body>
<div class="kl">
<?php
if ($nota>0) {
echo $display_block;
}
else {
echo "No attempts yet..";
}
?>
</div>
<!-- <a href="export_file.php?quiz_id=<?php echo $_GET['quiz_id']?>">Export Result</a> </div> -->
<div class="wrapper-inner-tab">
<div class="wrapper-inner-tab-backgrounds">
<div class="wrapper-inner-tab-backgrounds-first"><a href="logout.php" style="text-decoration:none;"><div class="sim-button button1"><span>Logout</span>
</div></a></div>
</div>
</div>
<div class="kk">
<div class="pk">
<div class="rk"><a href="export_file.php?quiz_id=<?php echo $_GET['quiz_id']?>" style="text-decoration:none;"><div class="sim-button button13"><span>Export Result</span>
</div></a></div>
</div>
</div>
</div>
</body>
</html>