arrays - Codeigniter - Querying 2 times in controller then passing the values in the view -


the first array had been passed, values can outputted while second array produces error.. tried use print_r command on both array , contains value

here's tried

controller

$project['project'] = (call model return value); $amenity['amenity'] = (call model return value);  $data['project'] = $project; $data['amenity'] = $amenity;  $this->load->view('view.php', $data); 

view

//this code works foreach($project $i){      echo 'title: '.$i[0]->title; } //this code produce error, undefined object $amenity foreach($amenity $j){      echo 'amenity: '.$j[0]->amenity; } 

do this:

$data['project'] = (call model return value); $data['amenity'] = (call model return value);  $this->load->view('view.php', $data); 

view:

// foreach $project foreach($project $i){      echo 'title: '.$i['title']; } // foreach $amenity foreach($amenity $j){      echo 'amenity: '.$j['amenity']; } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -