I'm trying to validate an username and check if this already exists in the system. Now the problem's that I've the user list in the table: `ea_user`
and the user settings in the table: `ea_user_settings`. Now:

```
ea_user > contain the id of the user that isn't remove from the system, the field 'data'

ea_user_settings > contain the username

```

So my function is this:

```
 public function validate_username($username, $user_id)
{
    $num_rows = $this->db->join('ea_user_settings', 'ea_user_settings.id = ea_user.id', 'inner')
                          ->get_where('ea_user_settings',
                              array('username' => $username, 'id_users <> ' => $user_id, 'ea_user.data' => 0))->num_rows();
    return ($num_rows > 0) ? FALSE : TRUE;
}

```

The problem's I get this error:

> 
> Fatal error: Call to a member function num\_rows() on a non-object
> 
> 
>