Thanks, AD! That cleared up a lot for me. You're posts are always so
informative. I'm going to star this for later.

On Mar 1, 1:03 am, "AD7six" <[EMAIL PROTECTED]> wrote:
> On Mar 1, 4:18 am, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
>
> > I figured it out. I did this:
> > $conditions[]['Post.created'] = '>= 2007-02-01';
> > $conditions[]['Post.created'] = '<= 2007-02-28';
> > $this->Post->find($conditions);
>
> > It seems the complex conditions section in the model chapter in the
> > CakePHP Manual was wrong. It seems as Cake continues, the manual just
> > seems older and older. Oh well, Cake still rocks.
>
> There is no error in the manual wrt to how to generate array
> constraints; I think there is a simple misunderstanding.
>
> $conditions['Post.created'] = array('>= 2007-02-01', '<=
> 2007-02-28');
> will generate
> ... WHERE `Post`.`created` IN ('>= 2007-02-01', '<= 2007-02-28') ...
> which is obviously not what you wanted. using an array in that manner
> ONLY generates an IN statemnet, it isn't used to build a list of
> conditions to apply to the same field, where in the manual does it
> suggest this will work?
>
> There are several alternatives to the final solution you found (just
> for info)
> 1)
> $conditions['Post.created'] = '>= 2007-02-01';
> $conditions[]['Post.created'] = '<= 2007-02-28';
> The only reason the extra array (or arrays in your solution) are
> needed is because otherwise you would overwrite one condition with
> another.
>
> 2)
> $conditions['Post.created'] = 'BETWEEN 2007-02-01 AND 2007-02-28';
> (iirc)
>
> >Oh well, Cake still rocks.
>
> indeederoony :)
>
> Cheers,
>
> AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to