The code for the query I'm trying to run is
$query = $this->db->select("*")->from('items')->like("replace(name, '=', ' ')", "foo bar", 'both')->get();
$items = $query->num_rows();
Mysql query string is
SELECT replace(name, ' = ', ' ') FROM `items`
What the code is doing is adding a blank space before and after "=" when compiling the query resulting in " = " which returns no results as there are no items with " = " in their names, only "=".
foo=bar, replace(name, '=', ' ') returns 1 result.
foo = bar, replace(name, ' = ', ' ') returns 0 results.
The version of CodeIgniter that I'm using is: 3.0.6
I have tested this on my copy of CodeIgniter and when formatted like this it works just fine:
$items = $this->db->like("replace(name, '=', ' ')", "foo bar", 'both')->get('items')->num_rows();
A few notes: