![]() |
Using dynamic data for array creation - 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: Using dynamic data for array creation (/showthread.php?tid=26703) |
Using dynamic data for array creation - El Forum - 01-21-2010 [eluser]Wittner[/eluser] Hi, I had a query which went something like this: (All of the below code is rough code for illustration purposes) Code: == CONTROLLER == .. all of which worked fine Now I want to dynamically create the array data in the controller from a query in a model, something like this: Code: == CONTROLLER == I think the result in the new version is begin returned as an object and not an array. Can anyone tell me the proper approach for this? cheers, Wittner Using dynamic data for array creation - El Forum - 01-21-2010 [eluser]flaky[/eluser] Code: return $this->db->get('tablename')->result_array();//returns array Using dynamic data for array creation - El Forum - 01-21-2010 [eluser]Wittner[/eluser] Thanks flaky. Slightly confused as to how to use this. Does that line belong in the model or the controller? Using dynamic data for array creation - El Forum - 01-21-2010 [eluser]flaky[/eluser] in the model Code: public function get_my_data(){ Using dynamic data for array creation - El Forum - 01-21-2010 [eluser]Wittner[/eluser] Gotcha! Thanks mate, cheers, Wittner [solved] |