Tuesday, October 26, 2010

Re: find() for fetching records

It depends on how you've saved your event data. I suppose that you use
a datetime field for the event's starting date. In that case you could
either utilize mysqls DATE_FORMAT function directly in the condition,
or add two boundaries in your find.

1) With date_format, a bit less cakey

conditions => array(
"DATE_FORMAT(datefield, '%m-%Y') = '10-2010'"
)

2) With a boundary

conditions => array(
"datefield >=" => "2010-10-01",
"datefield <=" => "2010-10-31"
)

On 26 okt, 08:33, arshu <arshad....@gmail.com> wrote:
> hi guys
>
> This is my first post on cakephp, i have an issue regarding the find
> in cakephp 1.2 ,in my project requirement i need to fetch data for
> differnt conditions.
>
> i have a calendar where i need to retrieve events in particualr month
> and particular year so how i can i use find method like
> find(''all',array('conditions' => array('month' = '10', 'year' =>
> '2010'), $fields)

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: