hi,
this is relating to a wordpress site, i have this query

$qstring="SELECT * FROM rwb_bk_schedule s INNER JOIN rwb_bk_rooms r ON s.room_id = r.room_id WHERE s.room_status=1 AND r.room_name='".$room."' AND start_date BETWEEN '".$sdate."' AND '".$edate."' OR end_date BETWEEN '".$sdate."' AND '".$edate."'";

as i given the code i use OR there between, but when i use OR this query wont return all the results which has s.room_status=1 rather return s.room_status=anything.
now can i check this ?
help much appreciated.

You have to bracket the clauses of the OR condition:

SELECT * 
FROM rwb_bk_schedule s 
INNER JOIN rwb_bk_rooms r 
ON s.room_id = r.room_id 
WHERE s.room_status=1 
AND r.room_name=$room
AND (start_date BETWEEN $sdate AND edate OR end_date BETWEEN sdate AND $edate)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.