Welcome Guest, Not a member yet? Register   Sign In
[Solved] Getting The User_id from DB then to Sessions
#1

[eluser]riwakawd[/eluser]
I am just trying to find out the best way to get the user id row number from my library and then set it in my sessions.

Code:
$this->load->library('user');

$data['action'] = site_url('login/login_credentials');

if ($this->form_validation->run($this)) {

   $data = array(
     'username' => $this->input->post('username'),
     'user_id' => $user_id, // Trying to get the user id row number. From my library file.
     'isLogged' => 1
   );

   $this->session->set_userdata($data);

   redirect('dashboard');

} else {

   $this->load->view('template/common/login', $data);

}

}
#2

[eluser]Otemu[/eluser]
Hi,

You would use something like this

Code:
$data = array(
     'username' => $this->input->post('username'),
     'user_id' => $this->user->your_user_id_function(), //
     'isLogged' => 1
   );




Theme © iAndrew 2016 - Forum software by © MyBB