Jenling Posted March 10, 2008 Share Posted March 10, 2008 Hello, Im building a booking system recently. The booking system is able to view the book the room and user is able to see if the room is available during the time. I know that the loop in half and hour range is something like this: for($i=$start; $i<$stop; $i=$i+50) { $contents .= " <tr>\n"; $first_num = substr($i, 0, -2); if(substr($i, -2) == 50) $last_num = '30'; else $last_num = '00'; if($last_num == 30) { $sec_last_num = '00'; $sec_first_num = $first_num+1; } else { $sec_last_num = '30'; $sec_first_num = $first_num; } $contents .= " <td class=\"timecell\">".$first_num.":".$last_num."-".$sec_first_num.":".$sec_last_num."</td>\n"; for($g=0; $g<7; $g++) { $seek_time = $g*24*60*60+$last_monday+($first_num*60*60+$last_num*60); $s_result = search_between($seek_time, $result); if(!$s_result) { $MRname = " "; $not_found = false; } else { $not_found = true; $MRname = stripslashes($s_result['MRname']); if($cycle[$g] == 0 && (($s_result['endTime'] - $s_result['startTime'])/60/30) >= 1) { $cycle[$g] = ($s_result['endTime'] - $s_result['startTime'])/60/30; $begin = 1; // Kerrotaan, että täytyy aloittaa solu } } However, i dont know how to loop it if I want the range to be in one hour range, for example, 0800-0900 and so on till 1700-1800. Can anyone help me with this? ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.