【发布时间】:2015-12-17 17:17:56
【问题描述】:
我正在尝试验证用户名并检查系统中是否已存在该用户名。现在的问题是我在表格中有用户列表:ea_user
以及表中的用户设置:ea_user_settings。现在:
ea_user > contain the id of the user that isn't remove from the system, the field 'data'
ea_user_settings > contain the username
所以我的功能是这样的:
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;
}
问题是我得到这个错误:
致命错误:在非对象上调用成员函数 num_rows()
【问题讨论】:
标签: sql codeigniter