try this

$this->Link->findAll(array(' id IN (' . implode(',', $topLinks) . ')',
'status' = > UC_STATUS_APPROVED));

-Ketan
http://www.propertyjungle.in
http://www.innovatechnologies.in

On Jun 9, 12:15 pm, Abhimanyu Grover <[EMAIL PROTECTED]> wrote:
> Hey,
>
> This is not Cake specific, but just posting here as I think this will
> be useful for others as well. Here's my code:
>
>                         $topLinks = $this->Vote->getTopRated();
>                         $this->set('links', 
> $this->Link->findAll(array('Link.id'=>
> $topLinks, 'Link.status'=>UC_STATUS_APPROVED)));
>
> In first line, I'm trying to get Id's of all top rated links - which
> comes from a bit complex algorithm.
> In second line, I pass on those ids to findAll() which creates sql
> statement like this:
>
> WHERE `Link`.`id` IN (1, 5, 7, 4, 3)
>
> Now problem is, I need them in same order as I've sent them in IN(..)
> but mysql returns them ordering by id. i.e. 1, 3, 4, 5, 7
>
> I've tried appending Order by NULL, but it wouldn't work. Can anyone
> help?
>
> Thanks,
> Abhimanyu Grover

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to