Below is my Find condition to get records matching <= next 1 hr show timings.
$conditions = array(
"CONCAT(`showdate`,' ',`hours`,':',`minutes`,':00') <" => "DATE_ADD(NOW(), INTERVAL 1 HOUR)",
"CONCAT(`showdate`,' ',`hours`,':',`minutes`,':00') >=" => "NOW()");
If run same query in PHPMyAdmin - SQL prompt, its working as below:
SELECT * FROM `showtimes` WHERE CONCAT( `showdate` , ' ', `hours` , ':', `minutes` , ':00' ) < DATE_ADD( NOW( ) , INTERVAL 1 HOUR ) AND CONCAT( `showdate` , ' ', `hours` , ':', `minutes` , ':00' ) >= NOW( ) LIMIT 0 , 30
Above MySQL query is running fine, but when I check with CakePHP Find, its not working.
Below is combination for same:
$conditions = array(
"CONCAT(`showdate`,' ',`hours`,':',`minutes`,':00') <" => "DATE_ADD(NOW(), INTERVAL 1 HOUR)",
"CONCAT(`showdate`,' ',`hours`,':',`minutes`,':00') >=" => "NOW()",
);
pr($conditions);
$this->Showtime->recursive = -1;
$areas = $this->Showtime->find('all',
array(
'conditions' => $conditions,
'limit' => $limit,
'offset' => $offset,
'group' => 'Showtime.id',
)
);
pr($areas);
Any help or ideas will be appreciated.