> > Hi all, > > I'm trying to return a find result in an order specified by a given value.. > > function getAllResults($A=1, $B='red'){ > $results = $this->Tbl->find(all, array( > 'conditions' => array('Tbl.foreign_key' => $A), > 'order' => array('Tbl.color' => $B) > )); > } > > I've seen: 'order' => array("FIELD(Tbl.color, value_1, value_2, value_3)") > But FIELD takes an array and I would like to use just one value=red. > Besides how would I even know where my required value is located in the > array( value_1, value_2, value_3) using FIELD unless it's hard coded. > > I've also seen: > > select * from your_tableorder by case when name = 'core' then 1 else 2 end, > priority > > And: > select id, name from friends order by id=5 desc, id asc > select id,name from friends order by id=5 desc, id asc > > Which is what I really want to do but can't figure out how to write it the > cakephp way. > > > Thanks >
-- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.