Codeigniter Foreign Key data retrieve
Try:
$query = $this->db->select('*') ->from('work') ->join('person', 'person.id = work.personname') ->get();return $query;
Use it like this:
foreach ($query->result() as $row){ echo $row->name;}
You can read the docs here on how to use the query builder:
http://www.codeigniter.com/user_guide/database/query_builder.html