Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $query = "select distinct(DATE_FORMAT(a.in_time, '%Y%m%d')) as in_time, a.user_id, a.notes, b.nama from attendance a left join dat_login b on(a.user_id=b.ID) where DATE_FORMAT(a.in_time, '%Y')='2017' and DATE_FORMAT(a.in_time, '%M')='April' order by b.nama asc";
- $stid = mysqli_query($conn, $query) or die (mysqli_error($conn));
- $count = mysqli_query($conn, "select count(distinct(a.user_id)) from attendance a left join dat_login b on(a.user_id=b.ID) where DATE_FORMAT(a.in_time, '%Y')='2017' and DATE_FORMAT(a.in_time, '%M')='April'") or die (mysqli_error($conn));
- $total = $count->fetch_row()[0] . "<br>";
- echo "<pre>";
- for ($i=11; $i <= $total; $i++) {
- while ($data = mysqli_fetch_assoc($stid)) {
- $alphabet_start = 'A';
- echo $data['nama'] . " ";
- if ($data['notes']=="") {
- echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Masuk <br>";
- } else if ($data['notes']=="S") {
- echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Sakit <br>";
- } else if ($data['notes']=="L") {
- echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Libur <br>";
- }
- }
- $alphabet_start++;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement