if(strtotime($din) != strtotime($dout))
{
$sql2="SELECT room.ROOM_ID,room_type.RT_ID FROM room,room_type
WHERE ROOM_ID NOT IN (SELECT ROOM_ID FROM booking WHERE (BK_CHECK_IN BETWEEN '$din' AND '$dout') OR (BK_CHECK_OUT BETWEEN '$din' AND '$dout')or ( '$din' BETWEEN BK_CHECK_IN and BK_CHECK_OUT) or ( '$dout' BETWEEN BK_CHECK_IN and BK_CHECK_OUT)) AND room_type.RT_ID=room.RT_ID AND room_type.RT_ID='2'";
$result2 = mysqli_query ($conn,$sql2);
while($rs = $result2->fetch_assoc()){
echo "ห้อง ".$rs["ROOM_ID"]." ว่าง<br>";
}
mysqli_data_seek($result2,0);
$row=mysqli_fetch_assoc($result2);
echo "ห้องแรกที่เจอคือ".$row['ROOM_ID']."<br>" ;
mysqli_free_result($result2);
$ROOM_ID=$row['ROOM_ID'];
}
else
echo '<span style="color:#FF3333"> กรุณาเลือกวันที่เช็คอิน-เช็คเอ้าใหม่';
?>