I am creating a small web application that allows users to reserve office space and equipment. For reservations, they enter a start and end date.
When a user tries to find out if any (for example) car is available in 2012-10-23, and the database contains records about the reservation date Start: 2012-10-20 and End: 2012-10-25 for (say) everything cars, how to include all dates between my dates in the search?
The variable $date gets this value from the date search field.
This, unfortunately, does not work, and I cannot figure out how to use daysAsSql for this query:
$conditions = array( 'conditions' => array( '? BETWEEN ? AND ?' => array($date,'Equipment.date_start','Equipment.date_end'), ))); $this->set('equipments', $this->Equipment->find('all', $conditions));
date search cakephp between
Joshua
source share