CodeIgniter Forums
Simple Query problem - 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: Simple Query problem (/showthread.php?tid=29547)



Simple Query problem - El Forum - 04-13-2010

[eluser]Ngulo[/eluser]
hi all

i'm trying to select data in this way but it is,i guess, really wrong:
Code:
$order_1=$this->db->order_by("hours", "asc");
$limit_1=$this->db->limit(1);
$data['query']=$this->db->get('table',$order_1,$limit_1);

which is the better way to write this simple query....i did can't find an example Sad

thanks for supporting Wink


Simple Query problem - El Forum - 04-13-2010

[eluser]n0xie[/eluser]
Something like this?
Code:
$data['query'] = $this->db->order_by("hours", "asc")->limit(1)->get('table');



Simple Query problem - El Forum - 04-13-2010

[eluser]Ngulo[/eluser]
perfect!!! really thanks n0xie Wink