You do it inside a representation like this.
Controller:
function get_name($id){ $this->load->model('mod_names'); $data['records']=$this->mod_names->profile($id); $this->load->view('mod_names_view', $data);
View (mod_names_view):
<?php foreach($records->result() as $record): ?> <?php echo $record->full_name); ?> <?php endforeach; ?>
I would change your model then to something like this (this worked for me):
function profile($id) { $this->db->select('*'); $this->db->from('names'); $this->db->where('id', $id); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query;
source share