Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. table schedule
  2.  
  3. ID | stud_id| day | timein | timeout
  4. 1 | 8888 | Monday | 08:00AM | 09:00AM
  5. 2 | 8888 | Monday | 10:00AM | 12:00PM
  6. 3 | 8888 | Monday | 01:00PM | 03:00PM
  7. 4 | 8888 | Tuesday| 05:00PM | 07:00PM
  8.  
  9. <?php
  10.  
  11. $query=$conn->query("SELECT * FROM schedule where day = Monday and stud_id = 8888")or die(mysql_error());
  12. $i = 0;
  13. $time = strtotime(date('h:iA'));
  14. while($row = $query->fetchall()){
  15. $count = $query->rowcount();
  16. if($count > 0){
  17. $timein = $row[$i]['timein'];
  18. $timeout = strtotime($row[$i]['timeout']);
  19. }
  20. if($time > $timeout){ //example time is 09:50am
  21. $i++;
  22. $timein;
  23. $timeout;
  24. }
  25. echo $timein, $timeout;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement