query only returns one row - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: query only returns one row (/showthread.php?tid=63093) |
query only returns one row - webmachine - 09-25-2015 I am very new to CodeIgniter and struggling with piecing together my first CI site. I am trying to use the Query Builder to get all the records from a database table called 'case_statuses'. In my Model I have Code: public function get_case_status() { In my Controller I have Code: public function index() { and in my file I have Code: <select name="case_status_id" id="case_status"> I did a var_dump of $case_status to see why I was getting an 'illegal offset' error message, and it looks like I am getting only one row of the table, instead of all six rows. What am I doing wrong? RE: query only returns one row - pdthinh - 09-25-2015 (09-25-2015, 12:38 PM)webmachine Wrote: I am very new to CodeIgniter and struggling with piecing together my first CI site. Change your model to return $query->result_array() to retrieve all rows of table. More references http://www.codeigniter.com/user_guide/database/results.html RE: query only returns one row - webmachine - 09-25-2015 (09-25-2015, 01:11 PM)pdthinh Wrote:(09-25-2015, 12:38 PM)webmachine Wrote: I am very new to CodeIgniter and struggling with piecing together my first CI site. Thank you! Worked like a charm. Now I need to go back to the documentation and find out why I made that mistake. |