associative arrays

Good evening,

I am a New comer in CodeIgniter and have some issues when passing parameters to the views.

I am trying to pass 20 random numbers to "views" and it looks it doesn't work because I need an associative array. Moreover in the "view", I use a foreach loop what definitely doesn't work.

Does someone knows how to pass a simple table (non associative) and display it in the views ?



The parameter is always an associative array.
$random = array(1,6,3,8,3,6,7);
$data['random'] = $random;
$this->load->view('myview', $data);

You can then iterate over it in the view
foreach ( $random as $value )
     echo $value;

:-) excellent :-)

Thank you very much


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.