Controller
function view_profil(){
$id = $this->session->userdata('idtabelX');
$profil[''] = $this->class_model->function_model($id);
$this->load->view('view_profil', $profil);
}
Model
function function_model($id){
$this->db->select('*');
$this->db->from('tabelA a');
$this->db->join('tabelB b','b.idtabelB=a.ididtabelB');
$this->db->join('tabelC c','c.idtabelC=a.idtabelC');
$this->db->where('idtabelX', $id);
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->row_array();
}
}
If the profile is clicked, it will show the data user profile stored in database, but if the user does not have the data profile in database, I want to redirect the user to a insert page to populate the profile data.
Thank you very much for help me to resolve this problem.