$query="SELECT * FROM room, bookings WHERE (room.roomtype_ID='$roomtype_ID') AND (and status='ว่าง') AND ((startdate BETWEEN '$ck_st' and '$ck_ed') OR (enddate BETWEEN '$ck_st' and '$ck_ed'))";
SELECT bookings.*, room.*
FROM bookings.room_ID=room.room_ID
WHERE room.status='ว่าง' AND
bookings.startdate >= '$ck_st' AND
bookingd.enddate <= '$ck_ed'
ขอบคุณ คุณNOOM มากครับ แก้ได้ล่ะครับผม
เล่นเช็ค if มันแบบแบบนี้เลยครับแฮะๆๆ
mysql_select_db($database_connresort, $connresort);
$query2="SELECT * FROM bookings WHERE roomtype_ID = '$roomtype_ID' AND ((startdate BETWEEN '$ck_st' and '$ck_ed') OR (enddate BETWEEN '$ck_st' and '$ck_ed'))";
$rsCheck2 = mysql_query($query2, $connresort) or die(mysql_error());
$row_rsCheck2=mysql_num_rows($rsCheck2 );
if ($row_rsCheck2!=0){
msg("ห้องมีคนจองแล้วครับ");
}else{
$query = "SELECT * FROM room WHERE room.roomtype_ID='$roomtype_ID' and status='ว่าง' order by room_ID ";
$rsCheck = mysql_query($query, $connresort) or die(mysql_error());
$row_rsCheck = mysql_fetch_assoc($rsCheck);
$room_ID=$row_rsCheck['room_ID'];
echo "go";
}