![]() |
Parsing arrays with arrays - 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: Parsing arrays with arrays (/showthread.php?tid=50576) |
Parsing arrays with arrays - El Forum - 03-30-2012 [eluser]_Smilie_[/eluser] Hi, So I'm trying to parse an Array to my view file, and that array contains another array. Controller: Code: function view(){ My view: Code: <?php foreach ($question_list as $question): Alright, so this produces a total of 3 errors: Code: Message: Trying to get property of non-object Line 19: array_push($data['question_list'], $this->convertQuest($row2->quest_type)); Dunno why it produces 3, as I only have one entry in my database.. Also I don't know why this error occurs at all ^^ Parsing arrays with arrays - El Forum - 03-30-2012 [eluser]Aken[/eluser] You're ending your database query with row(), which is returning a single row object, not an array of results. So when you are doing foreach ($row as $row2), you are looping the properties of that object, not an array of data. |