I have a 'rates' table
id | roomTypeId | periodFrom | periodTo | price
1 | 49 | 2010-8-1 | 2010-8-13 | 120
2 | 49 | 2010-8-14 | 2010-8-15 | 170
3 | 49 | 2010-8-16 | 2010-8-31 | 120
...
...
DATA:
- checkInDate = 2010-8-10
- checkOutDate = 2010-8-20
My query
$query = null;
$query .=" roomTypeId=".$obj->roomTypeId;
$query .=" AND periodFrom>='".$obj->checkInDate."'";
$query .=" AND periodTo<='".$obj->checkOutDate."'";
$stmt = $this->db->query ( 'SELECT * FROM rates WHERE '.$query);
...
...
and returns only
2 | 49 | 2010-8-14 | 2010-8-15 | 170
I want all the rates entries for that period.
thanks for any hint or suggestion