Why is it not showing me who is present and who is not?
The file are here.
The table is attendance with columns:
attendance_id | timestamp | year | class_id | section_id | student_id | class_routine_id | status
Status values: (0 undefined, 1 present, 2 absent)
<?php
$data = array();
$students = $this->db->get_where('enroll', array('class_id' => $class_id, 'year' => $running_year, 'section_id' => $section_id))->result_array();
foreach ($students as $row):
?>
<tr>
<td style="text-align: center;">
<?php echo $this->db->get_where('student', array('student_id' => $row['student_id']))->row()->name; ?>
</td>
<?php
$status = 0;
for ($i = 1; $i <= $days; $i++) {
$timestamp = strtotime($i . '-' . $month . '-' . $year[0]);
$this->db->group_by('timestamp');
$attendance = $this->db->get_where('attendance', array('section_id' => $section_id, 'class_id' => $class_id, 'year' => $running_year, 'timestamp' => $timestamp, 'student_id' => $row['student_id']))->result_array();
foreach ($attendance as $row1):
$month_dummy = date('d', $row1['timestamp']);
if ($i == $month_dummy)
$status = $row1['status'];
endforeach;
?>
<td style="text-align: center;">
<?php if ($status ==1 ) { ?>
<i class="entypo-record" style="color: #00a651;"></i>
<?php } if($status == 2) { ?>
<i class="entypo-record" style="color: #ee4749;"></i>
<?php } $status =0;?>
</td>