![]() |
Retrieving information from 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: Retrieving information from arrays (/showthread.php?tid=3775) |
Retrieving information from arrays - El Forum - 10-21-2007 [eluser]Robb__[/eluser] I'm having trouble getting this to work. Fist, I save information to theese arrays; Code: $data['Image'][$i] = $resultrow2[$i] ->Image; // {../Images/test.jpg, ../Images/test2.jpg, ../Images/test.jpg) Code: $this->load->view('index',$data); Then in my index.php I want to retrieve this information, but it doesn't work? Code: <?php for ($i=0; $i< $5; $i++): ?> Retrieving information from arrays - El Forum - 10-21-2007 [eluser]Michael Wales[/eluser] I would store my information a bit differently. Rather than making a variable amount of 'Image' or 'Name' arrays, I would make a variable amount of arrays, each with a 'Name' or 'Image' key - for example: Code: $data[$i]['Image'] = $resultrow2[$i] ->Image; // {../Images/test.jpg, ../Images/test2.jpg, ../Images/test.jpg) Then in your view: Code: <? foreach ($i as $product) { |