CodeIgniter Forums
Very simple DataMapper issue just installed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Very simple DataMapper issue just installed (/showthread.php?tid=48282)



Very simple DataMapper issue just installed - El Forum - 01-10-2012

[eluser]fireport[/eluser]
Datamapper latest version first orm i have been having a play for some reason i cannot get a foreach to in a view but it works in the controller. I have pasted a crude example any ideas?

controller
Code:
public function index()
{

  $c = new Make();
                $data['cars'] = $c->get();
  
  $this->load->view('car_edit',$data);

}
View sample

Code:
<?php echo $cars->Make; ?> //this works
<?php
// below this does not work
foreach ($cars as $ma) {
$ma->Make;  
}

?>