codeigniter passing array from controller to view undefined index error-Collection of common programming errors

your $this->rootbeer_model->community_single($rb); will return an array like this ie, rb_data=[[id=>1,value=>'a'],[id=>2,value=>'b'],[id=>3,value=>'c']]

so first you need to fetch the row that you wand, using this functions,

1. foreach($rb_data as $row){

}?> 2. $row = $rb_data->first_row() $row = $rb_data->last_row() $row = $rb_data->next_row() $row = $rb_data->previous_row() 3.$row = $rb_data->row(5);

then you can access `$row[‘band’]’

`$rb_data` doesn't contains an index like `band` . `$rb_data` contains only rows

Originally posted 2013-11-09 22:47:53.