Created
September 17, 2018 09:17
-
-
Save dev-wanjihia/b07eb6b09d9463dcd9bc1ca12960a7d8 to your computer and use it in GitHub Desktop.
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;"); | |
foreach($attendance->result() as $dateAttendance) | |
{ | |
// Do something with the records for $date. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment