|
|
|
php select ข้อมูล โดยให้เรียงลำดับจาก วันอะค่ะ MON TUE WED THU FRI |
|
|
|
|
|
|
|
ORDER BY FIELD(Language,'mon','tue','wed','thu','fri','sat','sun')
$sqlBooking = "SELECT * FROM db_booking WHERE room_no='". $result['room_no'] ."' order by field(book_date_b,'mon','tue','wed','thu','fri','sat','sun') ";
$resultBooking = mysql_query($sqlBooking);
while($recordBooking = mysql_fetch_array($resultBooking)){
$book_date_b=$recordBooking['book_date_b'];
$book_time_b=$recordBooking['book_time_b'];
$book_time_e=$recordBooking['book_time_e'];
if ($recordBooking['book_date_b']== mon)echo "<span style='background-color:yellow'><b>วันจันทร์</b></b></span>";
if ($recordBooking['book_date_b']== tue)echo "<span style='background-color:#B550C9'><b>วันอังคาร</b></span>";
if ($recordBooking['book_date_b']== wed)echo "<span style='background-color:#68CB7D'><b>วันพุธ</b></span>";
if ($recordBooking['book_date_b']== thu)echo "<span style='background-color:#CBA75F'><b>วันพฤหัสบดี</b></span>";
if ($recordBooking['book_date_b']== fri)echo "<span style='background-color:#45BBC8'><b>วันศุกร์</b></span>";
if ($recordBooking['book_date_b']== sat)echo "<span style='background-color:#8945C8'><b>วันเสาร์</b></span>";
if ($recordBooking['book_date_b']== sun)echo "<span style='background-color:#C95050'><b>วันอาทิตย์</b></span>";
echo " ";
echo $recordBooking['book_time_b'];
echo " - ";
echo $recordBooking['book_time_e'];
echo "<br />";
}
###
?>
|
|
|
|
|
Date :
2015-03-16 15:55:42 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขออนุญาติปรับแต่งหน่อยครับ
$dayweek = array("mon" => "วันจันทร์","tue"=>"วันอังคาร","wed"=>"วันพุธ",thu""=>"วันพฤหัสบดี","fri"=>"วันศุกร์","sat"=>"วันเสาร์","sun"=>"วันอาทิตย์");
$sqlBooking = "SELECT * FROM db_booking WHERE room_no='". $result['room_no'] ."' order by field(book_date_b,'mon','tue','wed','thu','fri','sat','sun') ";
$resultBooking = mysql_query($sqlBooking);
while($recordBooking = mysql_fetch_array($resultBooking)){
$book_date_b=$recordBooking['book_date_b'];
$book_time_b=$recordBooking['book_time_b'];
$book_time_e=$recordBooking['book_time_e'];
echo "<span style='background-color:yellow'><b>{$dayweek[$recordBooking['book_date_b']]}</b></span>";
echo " ";
echo $recordBooking['book_time_b'];
echo " - ";
echo $recordBooking['book_time_e'];
echo "<br />";
}
###
?>
|
|
|
|
|
Date :
2015-03-16 18:36:50 |
By :
ไม่ทราบแหล่งที่มา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|