Advertisement
Guest User

show_absence.php

a guest
Apr 25th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2.  
  3. $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";
  4. $stid = mysqli_query($conn, $query) or die (mysqli_error($conn));
  5.  
  6. $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));
  7. $total = $count->fetch_row()[0] . "<br>";
  8.  
  9. echo "<pre>";
  10. for ($i=11; $i <= $total; $i++) {
  11.   while ($data = mysqli_fetch_assoc($stid)) {
  12.   $alphabet_start = 'A';
  13.     echo $data['nama'] . " ";
  14.     if ($data['notes']=="") {
  15.       echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Masuk <br>";
  16.     } else if ($data['notes']=="S") {
  17.       echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Sakit <br>";
  18.     } else if ($data['notes']=="L") {
  19.       echo chr(ord("A") + date('d', strtotime($data['in_time']))) . $i . " - " . chr(ord("A") + date('d', strtotime($data['in_time']))) . ". " . "Libur <br>";
  20.     }
  21.   }
  22.   $alphabet_start++;
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement