php - If a DB field has a certain value show on top of results -
i know can accomplish using "when" i'm not sure how in codeigniter :(
will appreciate help.
$this->db->order_by("time_out = yes","asc"); // $this->db->where('status','pending'); $this->db->or_where('status','kitchen'); $sql = $this->db->get('pedidos');
what other values have time_out? why not sort time_out?
you can select if statement:
select *, if(time_out='yes',1,0) timeoutsort ......
then do
$this->db->order_by("timeoutsort","desc");
php mysql codeigniter
No comments:
Post a Comment