I am trying to pass from my controller to the view like so...
public function playerslist()
{
$this->load->database();
$data = $this->db->get('skaters');
$this->load->helper('url');
$this->load->view('playerslist', $data);
}
and in my view...
<?php echo $data; ?>
but I get this error...
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: views/playerslist.php
Line Number: 76
What am I doing wrong?
What I would like to do with this data is put in a foreach statement and display everything in the $data array
foreach($data as $value => $key){
echo $key . "<br/>";
}
Thanks, J