Codeigniter数据库使区分大小写

问题描述 投票:0回答:2

登录我的系统时,我需要考虑区分大小写。但密码不考虑案例。

    $this->db->select('user.*,userprofile.*,user.id as uid');
    $this->db->from('user');
    $this->db->join('userprofile', 'userprofile.id = user.id');
    $this->db->like('email', $udata['email']);
    $this->db->like('password', $udata["password"]);
    $query = $this->db->get();

以上是我的疑问。如何更改它以使其区分大小写?

database codeigniter case case-sensitive
2个回答
1
投票

一种可能的方法是

$this->db
    ->select('user.*,userprofile.*,user.id as uid')
    ->from('user')
    ->join('userprofile', 'userprofile.id = user.id')
    ->where('email', $udata['email'])
    ->where('BINARY password =', $this->db->escape($udata["password"]), false)
    ->get();

有关更多信息,请查看here


0
投票

我更改了我的变量名称以分别获取两个并在'where'中使用LIKE。

我改变了这个:

$this->db->like('password', $udata["password"]);

$this->db->where('password LIKE binary', $password);
© www.soinside.com 2019 - 2024. All rights reserved.