-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserexamresult.php
156 lines (135 loc) · 4.09 KB
/
userexamresult.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
include("header.php");
if(isset($_GET[delid]))
{
$sqldel ="DELETE FROM exam where examid=$_GET[delid]";
$seldelresult = mysqli_query($con,$sqldel);
if(mysqli_affected_rows($con) == 1)
{
$delresult = "<font color=green><strong>Record deleted successfully..</strong></font>";
}
}
$selexam = "SELECT exam.*, subjects.*, course.*
FROM course INNER JOIN
subjects ON course.courseid = subjects.courseid RIGHT OUTER JOIN
exam ON subjects.subjectcode = exam.subjectcode where exam.regno=$_SESSION[regno]";
$selresult = mysqli_query($con,$selexam);
?>
<div class="slider_top2">
<h2>View exam result</h2>
</div>
<div class="clr"></div>
<div class="body_resize">
<div class="body">
<div class="full">
<p>
<?php
echo $delresult;
?>
<table class="tftable" width=612 border=1>
<tr>
<th width="121" scope=col> Name</th>
<th width="121" scope=col> Registration number</th>
<th width="105" scope=col> Course</th>
<th width="105" scope=col> Subject</th>
<th width="170" scope=col> Datetime</th>
<th width="99" scope=col> Result</th>
<th width="99" scope=col> View</th>
</tr>
<?php
while($rs = mysqli_fetch_array($selresult))
{
$sqlstudentprofile = "SELECT * FROM students where regno=$rs[regno]";
$querystudentprofile = mysqli_query($con,$sqlstudentprofile);
$rsstudentprofile = mysqli_fetch_array($querystudentprofile);
echo "
<tr>
<td> $rsstudentprofile[name]</td>
<td> $rs[regno]</td>
<td> $rs[coursename]</td>
<td> $rs[subjectname]</td>
<td> $rs[datetime] </td>
<td> ";
$sqlcourse = "SELECT * FROM course where courseid=$rs[courseid]";
$qcourse = mysqli_query($con,$sqlcourse);
$rscourse = mysqli_fetch_array($qcourse);
$sqlsubjects = "SELECT * FROM subjects where courseid=$rs[courseid]";
$qsubjects = mysqli_query($con,$sqlsubjects);
$rssubjects = mysqli_fetch_array($qsubjects);
$sqlsubject = "SELECT * FROM exam INNER JOIN subjects ON subjects.subjectcode=exam.subjectcode where exam.examid=$rs[examid]";
$qsubject = mysqli_query($con,$sqlsubject);
$rssubject = mysqli_fetch_array($qsubject);
$sqlexamresult = "SELECT * FROM results where examid=$rs[examid]";
$qexamresult = mysqli_query($con,$sqlexamresult);
$rsexamresult = mysqli_fetch_array($qexamresult);
//unanswered questions
$sqlunanswered = "SELECT * FROM results where examid=$rs[examid] AND answerid=0";
$qunanswered = mysqli_query($con,$sqlunanswered);
$rsunanswered = mysqli_fetch_array($qunanswered);
//answered questions
$sqlanswered = "SELECT * FROM results where examid=$rs[examid] AND answerid<>0";
$qanswered = mysqli_query($con,$sqlanswered);
$rsanswered = mysqli_fetch_array($qanswered);
//Correct answers
$sqlexamresult = "SELECT * FROM results INNER JOIN questions ON questions.queid = results.queid where examid=$rs[examid]";
$qexamresult = mysqli_query($con,$sqlexamresult);
$totalquestions = mysqli_num_rows($qexamresult);
while($rsexamresult = mysqli_fetch_array($qexamresult))
{
if($rsexamresult[answerid] == $rsexamresult[answer])
{
$canswer = $canswer + 1;
}
else
{
$wanswer = $wanswer + 1;
}
}
if($totalquestions == 0)
{
echo "Result pending";
}
else
{
$totpercentagemarks = (($canswer*100) /$totalquestions);
if($totpercentagemarks > 70)
{
echo "Distinction";
}
else if($totpercentagemarks > 60)
{
echo "First class";
}
else if($totpercentagemarks > 45)
{
echo "Second Class";
}
else if($totpercentagemarks > 35)
{
echo "Pass";
}
else
{
echo "Failed";
}
}
echo "</td>
<td><a href=result.php?examid=$rs[0] target=_blank>View More</a></td>
</tr>";
}
?>
</table>
<p> </p>
<p> </p>
</div>
<div class="right">
<?php
include("usersidebar.php");
?>
</div>
<div class="clr"></div>
</div>
</div>
<?php
include("footer.php");
?>