Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table schedule
- ID | stud_id| day | timein | timeout
- 1 | 8888 | Monday | 08:00AM | 09:00AM
- 2 | 8888 | Monday | 10:00AM | 12:00PM
- 3 | 8888 | Monday | 01:00PM | 03:00PM
- 4 | 8888 | Tuesday| 05:00PM | 07:00PM
- <?php
- $query=$conn->query("SELECT * FROM schedule where day = Monday and stud_id = 8888")or die(mysql_error());
- $i = 0;
- $time = strtotime(date('h:iA'));
- while($row = $query->fetchall()){
- $count = $query->rowcount();
- if($count > 0){
- $timein = $row[$i]['timein'];
- $timeout = strtotime($row[$i]['timeout']);
- }
- if($time > $timeout){ //example time is 09:50am
- $i++;
- $timein;
- $timeout;
- }
- echo $timein, $timeout;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement