mysql,通过codeigniter进行区分大小写的比较
我想通过codeigniter的db助手类guide me plz编写以下查询mysql,通过codeigniter进行区分大小写的比较,codeigniter,Codeigniter,我想通过codeigniter的db助手类guide me plz编写以下查询 SELECT * FROM table where column like binary "abc"; 我试过了 $this->db->select("*"); $this->db->from("table"); $this->db->like("column","binary abc"); $this->db->get(); 但它产生了 SELECT * FROM
SELECT * FROM table where column like binary "abc";
我试过了
$this->db->select("*");
$this->db->from("table");
$this->db->like("column","binary abc");
$this->db->get();
但它产生了
SELECT * FROM table WHERE column like '%binary abc%'
使用:
$this->db->where('column-like-binary“abc”)$result=$this->db->get('table') 问候,
佩德罗使用: $this->db->where('column-like-binary“abc”)
$result=$this->db->get('table') 问候,
Pedrolike()助手不直接支持它,但您可以这样做:
$result = $this->db
->where('column like binary "abc"', NULL, FALSE)
->get('table')
->result();
另一种方法是:
$result = $this->db
->where('LOWER(column)', strtolower($foo), FALSE)
->get('table')
->result();
请注意,我使用的是方法链接,它速度更快,对我来说更整洁。like()帮助程序不直接支持它,但您可以这样做:
$result = $this->db
->where('column like binary "abc"', NULL, FALSE)
->get('table')
->result();
另一种方法是:
$result = $this->db
->where('LOWER(column)', strtolower($foo), FALSE)
->get('table')
->result();
请注意,我使用的是方法链接,它更快一些,对我来说更整洁。我使用了它,而且效果很好
$this->db->from("table_name");
$this->db->where('column_name like binary', $value);
我用了它,它成功了
$this->db->from("table_name");
$this->db->where('column_name like binary', $value);
它只是将字段值小写,并与小写的用户输入匹配,它还更新实际的数据敏感度,这意味着如果用户输入“abcd”,它将与数据库中的abcd匹配,这是错误的。除了更改列排序规则外,是否还有其他方法处理区分大小写的记录。它只需将字段值小写并与小写的用户输入匹配,还可以更新实际的数据敏感度,这意味着如果用户输入“abcd”,它将与数据库中的abcd匹配,这是错误的。除了更改列排序规则外,还有其他方法处理区分大小写的记录吗。