-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcertificates.php
129 lines (122 loc) · 3.38 KB
/
certificates.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
<?php
include("header.php");
if($_POST[setid] == $_SESSION[setid])
{
if(isset($_POST[submit]))
{
$sql="INSERT INTO certificates(certificateid, studentid, totalmarks, scoredmarks, result, status)
VALUES($_POST[certificateid],$_POST[studentid],$_POST[totalmarks],$_POST[scoredmarks],$_POST[result],$_POST[status])";
if(!mysqli_query($con,$sql))
{
die(Error: . mysqli_error($con));
}
else
{
echo "one record is added";
}
}
}
$_SESSION[setid]=rand();
$sql ="SELECT students.*, students.courseid AS Expr1,course.* FROM students INNER JOIN course ON students.courseid = course.courseid";
$qrecc = mysqli_query($con,$sql);
?>
<div class="slider_top2">
<h2>Certificate</h2>
</div>
<div class="clr"></div>
<div class="body_resize">
<div class="body">
<div class="full">
<p>
</p>
<table class="tftable" width="935" border="1">
<tr>
<th width="216" scope="col">Registraton No.</th>
<th width="193" scope="col">Student name</th>
<th width="127" scope="col">Course</th>
<th width="133" scope="col">Exam status</th>
<th width="33" scope="col">Action</th>
</tr>
<?php
while($rsrec = mysqli_fetch_array($qrecc))
{
echo "<tr>
<td> $rsrec[regno]</td>
<td> $rsrec[name]</td>";
echo "<td> $rsrec[coursename]</td>";
echo "<td> ";
/* #######################################################################################*/
$sqlexamresult1 = "SELECT * FROM exam where regno=$rsrec[regno]";
$qexamresult1 = mysqli_query($con,$sqlexamresult1);
while($rsexamresult1 = mysqli_fetch_array($qexamresult1));
{
$sqlexamresult = "SELECT * FROM results INNER JOIN questions ON questions.queid = results.queid where examid=$rsexamresult1[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 $resultst = "Result pending";
}
else
{
$totpercentagemarks = (($canswer*100) /$totalquestions);
if($totpercentagemarks > 70)
{
echo $resultst = "Distinction";
}
else if($totpercentagemarks > 60)
{
echo $resultst = "First class";
}
else if($totpercentagemarks > 45)
{
echo $resultst = "Second Class";
}
else if($totpercentagemarks > 35)
{
echo $resultst = "Pass";
}
else
{
echo $resultst = "Failed";
}
}
}
/* #######################################################################################*/
echo "</td>";
echo "<td> ";
if($resultst == "Result pending")
{
echo "Pending";
}
else if($resultst == "Failed")
{
echo "Failed";
}
else
{
echo "<a href=generatecertificate.php?regno=$rsrec[regno]>Generate certificate</a>";
}
echo " </td>
</tr>";
}
?>
</table>
</div>
<div class="clr"></div>
</div>
</div>
<?php
include("footer.php");
?>