I have a table which has costs for rooms based on from_date
and to_date
:
Format of db:
planid | roomtype_id | capacity_id | hotel_id |date_from | date_to | cost
and I want to get the cost of room based on arrival date which is stored in a input field when the arrival_date
falls in between date_from
and date_to
My code:
$result1 = mysql_query("SELECT * FROM room_price WHERE roomtype_id = '$roomtype_id' AND capacity_id = '$capacity_id' AND hotel_id = '$hotel_id' AND date_from '$date' BETWEEN date_from AND date_to");
The query doesn't gives any output.