-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstudent_attendance.php
86 lines (66 loc) · 2.1 KB
/
student_attendance.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
<?php
require('connect.php');
include("student_nav_bar.php");
?>
<!DOCTYPE html>
<title>Attendance</title>
<body>
<!-- Page Content -->
<div style="margin-left:20%">
<div class="w3-container w3-teal">
<h1>Attendance Page</h1>
</div>
<div class="w3-container">
<h2><?php echo $_SESSION['student_id']; ?></h2>
<p>The attendance in respective subjects are: </p>
<p><?php echo $_SESSION['name']; ?></p>
<p><?php echo $_SESSION['department']; ?></p>
<p><?php echo $_SESSION['semester']; ?></p>
<p><?php echo $_SESSION['class']; ?></p>
<?php
$usn = $_SESSION['student_id'];
$dept= $_SESSION['department'];
$semester = $_SESSION['semester'];
$class = $_SESSION['class'];
$student_attendance_table = $dept."_".$semester."_".$class."_attendance";
echo "$student_class_table";
echo " ";
$_SESSION['student_attendance_table']=$student_attendance_table;
$query = "SELECT * from courses where department='$dept' and semester='$semester' and class='$class'";
$result=mysqli_query($connection,$query);
while ($row=$result->fetch_assoc())
{
echo $row['course_code'];
$each_course = $row['course_code'];
$query1 = "SELECT count(*) as present_classes from $student_attendance_table where course_code='$each_course' and $usn='P'";
$result1=mysqli_query($connection,$query1);
$row1=$result1->fetch_assoc();
echo " ";
echo $row1['present_classes'];
$query2 = "SELECT count(*) as total_classes from $student_attendance_table where course_code='$each_course'";
$result2=mysqli_query($connection,$query2);
$row2=$result2->fetch_assoc();
echo " ";
echo $row2['total_classes'];
echo " ";
if($row2['total_classes']=="0")
{
echo "0";
}
else
{
echo $row1['present_classes']/$row2['total_classes']*100;
}
?>
<form action="complete_attendance.php" method="post">
<input class="btr" type="submit" name="complete_attendance" value="<?php echo $each_course;?>">
</form>
<?php
echo "<br>";
}
?>
</div>
</div>
</body>
</html>