Displaying all array values in a view. foreach not working for some reason. - 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: Displaying all array values in a view. foreach not working for some reason. (/showthread.php?tid=2234) |
Displaying all array values in a view. foreach not working for some reason. - El Forum - 07-24-2007 [eluser]jtotheb[/eluser] i have a model: Code: function contact_values() I have a controller: Code: function index() And i have a view: Code: <ul> And it only shows the first value in the view. Can anyone tell me where i'm going wrong? I think it must be in the controller, that i'm not passing the model result as an array properly to the $data array. If anyone can help i would be very grateful. Thanks. Displaying all array values in a view. foreach not working for some reason. - El Forum - 07-24-2007 [eluser]pr0digy[/eluser] Return is used only once, to return the function output. Here is what you should do: Code: function contact_values() Displaying all array values in a view. foreach not working for some reason. - El Forum - 07-24-2007 [eluser]jtotheb[/eluser] Great, thank you very much. Displaying all array values in a view. foreach not working for some reason. - El Forum - 07-24-2007 [eluser]deviant[/eluser] Code: function contact_values() Why bother with the foreach at all? |