Awesome!!!
Solved the problem in minutes. Thanks buddy..
Here's my new line:
$this->set('links', $this->Link->findAll(array('Link.id'=>$topLinks,
'Link.status'=>UC_STATUS_APPROVED),""," FIELD(Link.id,".implode(',',
$topLinks).")"));
This was something I couldn't find anywhere.Thanks again..
On Jun 9, 2:41 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 9, 2008 at 12:45 PM, Abhimanyu Grover <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > 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
>
> You have to use ORDER BY FIELD(id, 1, 5, 7, 4, 3)
> **
> I am sure you will figure out how to get cake to do it
>
> Tarique
>
> --
> =============================================================
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =============================================================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---