Tuesday, 15 January 2013

php - Unable to get the usernames user id for sessions in codeigniter -



php - Unable to get the usernames user id for sessions in codeigniter -

i have function in library called getid unable added in sessions not sure why can username ok

i have sessions autoloaded

how can user id of user logged in , have set in sessions.

public function login() { if($user_query->num_rows() == 1 ) { $this->getid = $this->user_id; $data = array( 'islogged' => true, 'user_id' => $this->user_id, 'username' => $this->ci->input->post('username') ); $this->ci->session->set_userdata($data); //$this->ci->db->query("update " . $this->ci->db->dbprefix . "user set ip = '" . $this->ci->input->ip_address() . "' user_id = '" . (int)$this->ci->session->userdata('user_id') . "'"); homecoming true; } else { homecoming false; } } public function logout() { $this->ci->session->sess_destroy(); } public function islogged() { } public function getid() { homecoming $this->ci->db->get_where('user', array('user_id' => $user_id))->row(); }

$getiddata = $this->getid($this->user_id); private function getid($userid) { homecoming $this->ci->db->get_where('user', array('user_id' => $user_id))->row(); }

as function depends on userid have pass variable.

php codeigniter

No comments:

Post a Comment