отображать сегодняшние заказы от mysql mrbs calendar

Я, как все в начале чего-то нового в этом. Я пытаюсь получить правильный запрос для отображения сегодняшнего заказа из календаря MRBS в порядке времени и комнаты для комнаты 1 10 -11, комната 2 из 10-11 комнаты1 из 11-14 комнаты 3 из 13-15. Я получил образец массива в течение недели от Rowland carson, но я хочу, чтобы он отображался в день и вовремя, у любого есть какие-то идеи? они очень приветствуются, что это будет организовано в школе, чтобы показать бронирование в день в экспедиции. это то, что у меня есть сегодня:

session_start(); $php_session_id = session_id(); $this_page = basename($_SERVER['PHP_SELF']); if ($_SESSION[ThisPage] == $this_page) { } define("ONE_DAY", (60*60*24)); $nowArray = getdate(); if ( $_POST[show_calendar] != "" ) // form submitted so capture data from it { switch ( $_POST[show_calendar] ) { case "chosen": if ( !checkdate($_POST['month'], $_POST['mday'], $_POST['year'])) { $day = $nowArray['mday']; $month = $nowArray['mon']; $year = $nowArray['year']; } else { $day = $_POST['mday']; $month = $_POST['month']; $year = $_POST['year']; } break; } } else // first pass, form not submitted { $day = $nowArray['mday']; $month = $nowArray['mon']; $year = $nowArray['year']; } $startTimestamp = mktime (0, 0, 0, $month, $day, $year); $theDateArray = getdate($startTimestamp); $theWeekday = $theDateArray['wday']; if ($theWeekday > 1) { $startTimestamp = $startTimestamp - ($theWeekday * ONE_DAY); $theDateArray = getdate($startTimestamp); } $theTimestamp = $startTimestamp; $startingDateArray = getdate($startTimestamp); $startYear = $theDateArray['year']; $dispTimestamp = $startTimestamp; //connect to database $conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die(mysql_error()); mysql_select_db($booking_db, $conn) or die(mysql_error()); $get_entries = "select timestamp from $bookings order by timestamp desc limit 1 " ; $entries_result = mysql_query($get_entries) or die(mysql_error()); $data_row = mysql_fetch_object($entries_result); $last_changed = $data_row->timestamp; $get_rooms = "select * from $rooms order by id " ; $rooms_result = mysql_query($get_rooms) or die(mysql_error()); $n_rooms = mysql_num_rows($rooms_result); $n_cols = $n_rooms + 1; $booking_block = "<TABLE align=center BORDER=1 CELLPADDING=5>\n"; $booking_block .= "<tr><td colspan=".$n_cols.">"; $booking_block .= "Room bookings for today "; $booking_block .= $startingDateArray['mday']." "; $booking_block .= $startingDateArray['month']." "; $booking_block .= $startingDateArray['year']." "; $booking_block .= "(Last change to any booking was made "; $booking_block .= $last_changed; $booking_block .= ")</td></tr>\n"; $booking_block .= "<tr><td align=right>".$startYear."</td>\n"; while ($rooms = mysql_fetch_array($rooms_result, MYSQL_ASSOC)) { $booking_block .= "<td>"; $booking_block .= $rooms['room_name']; $booking_block .= "</td>"; } $booking_block .= "</tr>\n"; for ($day_number = 0; $day_number <= 6; $day_number++) { $booking_block .= "<tr>\n"; $booking_block .= "<td align=right valign=top>"; $endOfDay = $theTimestamp + ONE_DAY; $theDateArray = getdate($theTimestamp); if ($theDateArray['year'] != $startYear) { $startYear = $theDateArray['year']; $booking_block .= $startYear."<br>"; } $booking_block .= date("D d M", $theTimestamp)."</td>\n"; for ($room_number = 1; $room_number <= $n_rooms; $room_number++) { $get_bookings = "select * from $bookings where start_time >= $theTimestamp and start_time <= $endOfDay and room_id = $room_number order by start_time " ; $bookings_result = mysql_query($get_bookings) or die(mysql_error()); $booking_block .= "<td valign=top>"; if (mysql_num_rows($bookings_result) > 0) { while ($booking_entry = mysql_fetch_array($bookings_result, MYSQL_ASSOC)) { $booking_block .= date("H:i", $booking_entry['start_time']); $booking_block .= "-"; $booking_block .= date("H:i", $booking_entry['end_time']); $booking_block .= " "; $booking_block .= $booking_entry['name']; $booking_block .= "<br>\n"; } } else { $booking_block .= "<br>"; } $booking_block .= "</td>"; } $booking_block .= "</tr>\n"; $theTimestamp = $theTimestamp + ONE_DAY; } $booking_block .= "<tr><td colspan=".$n_cols." align=right>"; $booking_block .= "This web page rendered on "; $booking_block .= $nowArray['mday']." "; $booking_block .= $nowArray['month']." "; $booking_block .= $nowArray['year']." "; $booking_block .= "</table>\n"; // Close the database connection mysql_close($conn); ?> <html> <head> <meta http-equiv="Content-Style-Type" content="text/css"> <link type="text/css" rel="stylesheet" href="q_style.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title><?php echo "Room bookings for week of ".$startingDateArray['mday']." ".$startingDateArray['month']." ".$startingDateArray['year'] ?></title> <head> <body> <?php include("page_header.php") ?> <hr> <table border=0 cellpadding=1 width="100%"> <tr> <td align=right>&nbsp;</td> </tr> </table> <table align=center BORDER=0 CELLPADDING=5 width="100%"> <tr> <td> <?php echo $booking_block; ?> </td> </tr> </table> <table border=0 cellpadding=1 width="100%"> <tr> <td>&nbsp;</td> </tr> </table> <hr> 

Related of "отображать сегодняшние заказы от mysql mrbs calendar"

Этот SQL вернет наши заказы по заказу start_time и room_id –

 SELECT * FROM $bookings WHERE start_time >= UNIX_TIMESTAMP(CURRENT_DATE) AND start_time < UNIX_TIMESTAMP(CURRENT_DATE + INTERVAL 1 DAY) ORDER BY start_time, room_id 

Если это не то, что вы ищете, вам нужно будет приложить больше усилий в свой вопрос. Каковы имена таблиц и их структуры? В каком формате вы ожидаете выхода?