CodeIgniter Forums
Problems getting foreach loop to display data - 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: Problems getting foreach loop to display data (/showthread.php?tid=56631)

Pages: 1 2


Problems getting foreach loop to display data - El Forum - 01-08-2013

[eluser]douglasbrownca01[/eluser]
Yep, that gets me one result -- but as I read that -- it's just looking for the first item in the array object. I want to return a set of rows into a table. So is there a way to loop it in the view to bring back the full contents of the array?

I guess what i don't understand is why the original $fingerguard->item_code didn't work and just loop through the dataset like it did in the get_accessories function.


Problems getting foreach loop to display data - El Forum - 01-08-2013

[eluser]douglasbrownca01[/eluser]
Yep, that gets me one result -- but as I read that -- it's just looking for the first item in the array object. I want to return a set of rows into a table. So is there a way to loop it in the view to bring back the full contents of the array?

I guess what i don't understand is why the original $fingerguard->item_code didn't work and just loop through the dataset like it did in the get_accessories function.


Problems getting foreach loop to display data - El Forum - 01-08-2013

[eluser]douglasbrownca01[/eluser]
Ok, I figured it out -- or at least where my mistake was. My original approach was correct with building the queries all under the get_accessories() function in my Model. I was returning the results early -- I've got it working correctly now for multiple instances. Thanks for all your help.