Multidimensional array read-out in view |
[eluser]Unknown[/eluser]
When I output print_r($data); I get: Code: Array My question is, how do I access [0] and [1] and put them in a loop?
[eluser]Michael Wales[/eluser]
CI automatically brings the var array to the top level - I've never dove into the code to see why. So, you should be able to loop through those arrays like so: Code: foreach ($0 as $key => $val) { If that doesn't work for you just change $0 and $1 to $vars[0] and $vars[1], respectively.
[eluser]Unknown[/eluser]
I belive you want to have a multidimensional foreach loop that loops the numbers to, like: Code: foreach($var as $key => $val) { Code: 0 So you have to make sure you pass the vars to the view something like this: Code: [vars] => Array |
Welcome Guest, Not a member yet? Register Sign In |