did work man here my code
function checkLogin() { $this->load->helper('cookie'); $u1 = get_cookie('username'); $p1 = get_cookie('password'); $logged = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1)); if($logged->num_rows() > 0) { $row = $query->row(); $uId = $row->id; $uName = $row->username; $data['userId'] = $uId; $data['userName'] = $uName; return $data; } }
To get access to your returned data you need to do in your controller
$userdata = $this->model_name->checkLogin();
if($userdata)
{
echo $userdata['userId'];
//or assign it to another variable to use later in your view
}Also to make things cleaner instead of returning just the $data array you could
return $row;
//instead of
return $data
//then you have access to the entire query result
//from your controller you would then do
$userdata = $this->model_name->checkLogin();
if($userdata)
{
echo $userdata->table_field_name;
//or assign it to another variable to use later in your view
}