CodeIgniter Forums
Odering results in descending - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: Odering results in descending (/thread-40900.html)



Odering results in descending - El Forum - 04-21-2011

[eluser]Alias M2K[/eluser]
Guys, I was wondering if there is any way to order the results from MySQL tables in descending order? I mean any active query other than the classic MySQL query?

Thanks Smile


Odering results in descending - El Forum - 04-21-2011

[eluser]Eric Barnes[/eluser]
Sure you can:
Code:
$this->db->from('table')->order_by('id', 'desc');



Odering results in descending - El Forum - 04-21-2011

[eluser]kotakorange[/eluser]
use $this->db->order_by('field', 'sort');
You can read the user guide


Odering results in descending - El Forum - 04-22-2011

[eluser]Alias M2K[/eluser]
Thanks dude Smile

Just made few modifications on it, and I am done! Thanks! Big Grin