Friday, January 1, 2010

Re: find method fetching all ids in single query

yeah thanks,

this method is the same i found after few hours posting this question

mike karthauser wrote:
>
>
> On 1 Jan 2010, at 12:56, engine wrote:
>
>>
>> I am putting this in straight forward and simple manner
>>
>> How to get the number of rows that corresponds to number of ids in a
>> single
>> $this->Model->find() query
>>
>> i mean i have one array of ids say
>> $list = array('0 => 125, 2 => 145, 3 => 458, ......so one) the second
>> parameter in this array is id from model table how can i fetch all of
>> them
>> in single find query. I have tried to use OR condition but that doesnt
>> allow
>> me to enter above array.
>
>
> i would hazard you just need
>
> array(
> "Model.id" => $list
> )
>
> where $list is your array.
>
> look at
> http://book.cakephp.org/view/74/Complex-Find-Conditions
>
> which should help.
>
>
> --
> Mike Karthäuser
> Managing Director - Brightstorm Ltd
> Email: mikek@brightstorm.co.uk
> Web: http://www.brightstorm.co.uk
> Tel: 07939 252144
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
>
> 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
>
>


-----
http://www.libmaker.com/ sell books online | http://www.milestree.com/
Web/tech
news | http://www.hiclicks.com/ seo and usability service
--
View this message in context: http://old.nabble.com/find-method-fetching-all-ids-in-single-query-tp26985219p26985880.html
Sent from the CakePHP mailing list archive at Nabble.com.

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: