, . . :
CONTROLLER:
$this->load->model('Profile');
$data['row'] = $this->Profile_model->profile_read();
$this->load->view('profile_view', $data);
Model:
function profile_read()
{
$this->db->where('user_id', $user_id);
$query = $this->db->get('user_profiles');
return $query->row();
}
In the model, you can use all other database functions (create, delete, update)
VIEW:
<?php echo $row->name; ?>
<?php echo $row->email; ?>
<?php echo $row->about; ?>
etc
Finally, in the view, you can echo from any rows from the table owned by the user.
source
share