-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_attendance.php
97 lines (71 loc) · 1.99 KB
/
show_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
87
88
89
90
91
92
93
94
95
96
97
<?php session_start();
include("db.php");
include("header.php");
if(!isset($_SESSION['logged_in']))
echo "<script>window.location.href='index.php';</script>";
$date=date("d-m-Y");
?>
<div class="container">
<h2><center><b>Show Attendance<b><br><h4>Date: <?php echo $date; ?></h4></center> </h2>
<div class="panel panel-default">
<div class="panel panel-body">
<!-- to display values in table using loop -->
<?php $result=mysqli_query($con,"select * from attendance where admno='$_POST[admno]' and subject='$_SESSION[subject]' ");
//check f attendance available for today
if(mysqli_num_rows($result)<=0)
{
?>
<h3>
<center>
<p> No Attendance available.</p>
<a href="home.php" class="btn btn-primary btn-lg">Take Attendance</a>
</center>
</h3>
<?php
}
//if schedule is not mae then promt user to make schedule
else
{
//table heading
?>
<h2><?php echo strtoupper($_POST['name']); ?> </h2>
<h5>
<?php
//Attendance percentage
$total=mysqli_query($con,"select COUNT(*) as 'count' from attendance where admno='$_POST[admno]' and subject='$_SESSION[subject]' ");
$zzz = mysqli_fetch_assoc($total);
echo 'Total No of Clases : ';
echo $zzz['count']. "<br>";
$present=mysqli_query($con,"select COUNT(*) as 'count' from attendance where admno='$_POST[admno]' and subject='$_SESSION[subject]' and status='present' ");
$zz = mysqli_fetch_assoc($present);
echo 'No of Clases Present : ';
echo $zz['count']. "<br>";
echo 'Attendance Percentage : ';
echo ($zz['count']/$zzz['count'])*100;
?>
</h5>
<table class="table table-stripped">
<tr>
<th>Date</th><th>Period</th><th>Status</th>
</tr>
<?php
while($row=mysqli_fetch_array($result))
{
?>
<tr>
<td><?php echo $row['date']; ?>
</td>
<td><?php echo $row['period']; ?>
</td>
<td><?php echo $row['status']; ?>
</td>
</tr>
<!-- loop ends -->
<?php
}
}
?>
</table>
</div>
</div>
</div>