I have this controller where all the available users and its respective information are passed in the view through an array:
function view() {
$data = array();
if($query = $this->m_user->get_user()) {
$data['user'] = $query;
}
$this->load->view('v_view_user', $data);
}
In my view I used this method (the norm) to view all that was passed:
<?php echo "user_name here" ?>
<?php if(isset($user)) : foreach ($user as $row) :
echo $row->user_name;
end foreach;
end if;
?>
What I want to do is to print a specific index (the name to be specific) before the code given above.
For the model:
function get_employees() {
$query = $this->db->get('user');
return $query->result();
}
By the way, the array contains user_id, user_name, user_family_name, ..., [and other more].
Your help will be highly appreciated.