mysql, case sensitive compare through codeigniter

I wanted to write following query through codeigniter's db helper class, guide me plz

SELECT * FROM table where column like binary "abc";

I tried

$this->db->like("column","binary abc");

but it produces

SELECT * FROM table WHERE column like '%binary abc%'


It is not supported directly through the like() helper, but you can do this:

$result = $this->db
    ->where('column like binary "abc"', NULL, FALSE)

An alternative method is:

$result = $this->db
    ->where('LOWER(column)', strtolower($foo), FALSE)

Notice I am using method chaining, it's a little quicker and to me is neater.


$this->db->where('column like binary "abc"'); $result=$this->db->get('table');

Regards, Pedro

I used that and it worked

$this->db->where('column_name like binary', $value);

Need Your Help

GridX clear the sort without making new request

javascript sorting dojo gridx

I am using GridX to display data, but I often change the data store that the GridX is using. I do this by using grid.setStore() and pass in a Dojo JsonStore (this is asynchronous data of course). I...

ASP.NET MVC 4 form cannot logout

c# partial-views logout

I have been fiddling around with the _Layout and _PartialLayouts of the default MVC 4 templates and suddenly the 'Logout' feature in the '_PartialLogin' doc has stopeed working.