Help -> Doing a Select using Active Record - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Help -> Doing a Select using Active Record (/showthread.php?tid=26523) |
Help -> Doing a Select using Active Record - El Forum - 01-15-2010 [eluser]alejandronanez[/eluser] Hello Guys! I need to do a Select using AR, but it doesn't work. Here's the code. Model: Code: function obtener_todos($number_items,$offset){ Controller (part where I use $query variable): Code: $data['records'] = $this->area_en_nom_model->obtener_todos($config['per_page'],$this->uri->segment(3)); And finally my view: Code: echo $this->table->set_heading('COD_DESCRIPCION', 'DESCRIPCION'); It always returns 3 columns, it's like Code: SELECT * FROM table Code: SELECT field2 , field3 FROM table IDK what's wrong. Thanks everybody. Ps. I also tryed this on the model: Model: Code: function obtener_todos($number_items,$offset){ But it returns field1(ID) and field2 , I need field2 and field 3. Help -> Doing a Select using Active Record - El Forum - 01-16-2010 [eluser]flaky[/eluser] try this Code: $query = $this->db->get('table',$number_items,$offset)->result_array(); |