This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Select all the dates in from 01 August 2018 to 31 August 2018 | |
$dates = $this->db->query("select substring(checktime, 1, 10) as date from checkinout where substring(checktime, 1, 10) < '2018-08-31' and substring(checktime, 1, 10) > '2018-08-01' group by date; | |
"); | |
foreach ($dates->result() as $date) | |
{ | |
// Now select the records for the particular date. | |
$attendance = $this->db->query("select userid, username, times.timez as time from (select logid,userid,username, substring(checktime, 11) as timez, substring(checktime, 1, 10) as time from checkinout where substring(checktime, 1, 10) = '$date' order by timez asc) as times where times.logid = logid group by userid;"); |