How:
$results = $this->User->find('all', array(
'order' => "(User.id>=$userId) DESC, User.id ASC"
));
Why:
For $userId = 3:
3, 4, 5 : (User.id>=$userId) is 1
1, 2 : (User.id>=$userId) is 0
So 3,4 and 5 are first (themselves ordered by ID so they appear in
that order)
Then 1, 2 (again, ordered internally)
hth
grigri
On Jun 20, 9:55 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 20, 2008 at 2:15 PM, Fahad <[EMAIL PROTECTED]> wrote:
> > findAll(), the record with ID 1 and 2 will added after ID 5.
>
> > ===============
> > output (starting from ID 2)
> > 3, anthony
> > 4, ben
> > 5, jonathan
> > 1, john
> > 2, james
> > ===============
>
> #1 use two queries and array_merge the results
>
> #2 Do a simple find all and use array_slice with array_merge
>
> HTH
> 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
-~----------~----~----~----~------~----~------~--~---