![]() |
multidimensional array in view - 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: multidimensional array in view (/showthread.php?tid=69974) |
multidimensional array in view - nadeem14375 - 02-05-2018 hi all, I have the following array from my model, here the var_dump: Quote:array(4) { here my view for loop: PHP Code: $i=0; It display the 1st row, but for next rows give following error: Quote:A PHP Error was encountered RE: multidimensional array in view - Wouter60 - 02-05-2018 The array from your model has 4 elements, which are arrays too. Each of these 4 elements has only one element (index 0). That's why it doesn't accept index 1. Try this: PHP Code: foreach ($payments_view as $key => $data) { The foreach loop will let you display all rows. There's no need to use the $i variable as an index. RE: multidimensional array in view - nadeem14375 - 02-08-2018 (02-05-2018, 11:30 AM)I need to display the multiple records from this array, your loop just return 0 index. Wouter60 Wrote: The array from your model has 4 elements, which are arrays too. |