Hello Claudia,
This approach worked perfectly with my setup. Thank you!
- Daniel
On Sep 10, 3:39 am, Claudia <[EMAIL PROTECTED]> wrote:
> It is a bit different from your example but here is how I use between:
> $startDateCond = array('Event.start_date' => 'BETWEEN ' . UDAYSTART .
> ' AND ' . (UDAYSTART + MONTH + MONTH));
>
> The resulting SQL is something like:
> (`Event`.`start_date` BETWEEN '1218405600' AND '1226181600')
>
> which works fine.
>
> Cake version is 1.2.0.5427alpha
>
> Claudia
>
> On Sep 10, 4:32 am, Daniel <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone,
>
> > I'm trying to perform a find operation on my 'event' model in order to
> > retrieve "events" that fall within a specific date range. I've read
> > the manual on the process to do complex find conditions but thus far
> > I've been unable to get it to generate working SQL code that will
> > accomplish my goal.
>
> > The following is my find statement (here's to hoping the formatting
> > sticks somewhat) :
>
> > $events = $this->Event->find('all', array('recursive' => 1,
> > 'conditions' => array(
> > 'User.id' => $currUser['id'],
> > 'or' => array(
> > 'Event.startTime BETWEEN ? AND ?' =>
> > array($bottomSearchBound,$topSearchBound),
> > 'Event.endTime BETWEEN ? AND ?' =>
> > array($bottomSearchBound,$topSearchBound)
> > )
> > )
> > ));
>
> > The sql it generates (snipped version) is as follows:
>
> > WHERE `User`.`id` = 7 AND ((`Event`.`startTime BETWEEN ? AND ?` IN
> > ('2008-08-01', '2008-10-01') ) OR (`Event`.`endTime BETWEEN ? AND ?`
> > IN ('2008-08-01', '2008-10-01') ))
>
> > And the error it generates is:
>
> > Warning (512): SQL Error: 1054: Unknown column 'Event.startTime
> > BETWEEN ? AND ?' in 'where clause'
>
> > Obviously the "?" token replacement isn't being completed
> > successfully.
>
> > Any help would be _greatly_ appreciated!
>
> > - Daniel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---