CodeIgniter Forums
Getting user id - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Getting user id (/showthread.php?tid=79417)



Getting user id - Lipe_Bogaci - 06-12-2021

Hi guys how can i get the id of the user on users table? I use this function but it mismatch the role_id with id on users table
   public function login($data){

        $this->db->from('users');
        $this->db->join('roles','roles.id = users.role_id');
        $this->db->where('users.username'$data['username']);
        
        $query = $this->db->get();
        if ($query->num_rows() == 0){
            return false;
        }
        else{
            $result = $query->row_array();
            $validPassword = password_verify($data['password'], $result['password']);
            if($validPassword){
                return $result = $query->row_array();
            }
        }
    }



RE: Getting user id - paliz - 06-12-2021

Go there

https://github.com/lonnieezell/myth-auth


RE: Getting user id - Lipe_Bogaci - 06-13-2021

(06-12-2021, 11:39 PM)paliz Wrote: Go there

https://github.com/lonnieezell/myth-auth


Thank you.
any idea how can i edit this query and get the user id also?