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.

On Feb 28, 4:13 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
> It's worth noting that this isn't working either:
> $conditions['Post.id'] = array('>= 1', '<= 10');
> $this->Post->findAll($conditions);
>
> I think I don't understand how Cake deals with these ranges.
>
> On Feb 28, 4:10 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to find all Posts within a given range of dates (the month
> > of February 2007 in this example), and I can't figure it out.
>
> > This isn't returning any results:
> > $conditions['Post.created'] = array('>= 2007-02-01', '<= 2007-02-28');
> > $this->Post->findAll($conditions);
>
> > The strange part is that this works:
> > $conditions['Post.created'] = '>= 2007-02-01';
> > $this->Post->findAll($conditions);
>
> > And so does this:
> > $conditions['Post.created'] = '<= 2007-02-31';
> > $this->Post->findAll($conditions);
>
> > And so does this, assuming that posts exist on both those days, and it
> > only returns posts on those days:
> > $conditions['Post.created'] = array('2007-02-01', 2007-02-31');
> > $this->Post->findAll($conditions);
>
> > It also works if I query the database directly like this:
> > select * from posts where created >= '2007-02-01' && created <=
> > '2007-02-31';
>
> > Am I missing somthing? Why isn't this working?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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