CodeIgniter Forums
Creating custom 'order_by' string - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Creating custom 'order_by' string (/showthread.php?tid=11096)



Creating custom 'order_by' string - El Forum - 08-25-2008

[eluser]MABUS[/eluser]
Hi,

Is there a way to ORDER BY a specified CASE or IF in CodeIgniter? Right now, I am having to write my entire query in SQL. I'm curious to find out if there is a CI way to do this.

In addition to this, I also want to know if active record class methods is able to handle additional query strings.


Creating custom 'order_by' string - El Forum - 08-26-2008

[eluser]Jilani Jidni[/eluser]
[quote author="MABUS" date="1219746947"]Hi,

Is there a way to ORDER BY a specified CASE or IF in CodeIgniter? Right now, I am having to write my entire query in SQL. I'm curious to find out if there is a CI way to do this.

In addition to this, I also want to know if active record class methods is able to handle additional query strings.[/quote]

Please read the active record manual and hope you will get your solution

http://ellislab.com/codeigniter/user-guide/database/active_record.html


Creating custom 'order_by' string - El Forum - 08-26-2008

[eluser]newsun[/eluser]
While reading the above mentioned TOC section look for this part:
Code:
$this->db->order_by();