Jump to content

How to loop between one hour??


Jenling

Recommended Posts

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? ???

   

Link to comment
https://forums.phpfreaks.com/topic/95448-how-to-loop-between-one-hour/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.