I've written a simple query for searching a keyword in the database.
$keyword = "keyword sample";
$keyword = str_replace(" ", "%", $keyword);
$this->db->select('*')->from('table')
->like('column', "%".$keyword."%")->get();
Now the query generated by Codeigniter is like this:
SELECT * FROM (`table`) WHERE `column` LIKE '%keyword\%sample%'
Where is the trailing \
coming from in the query? This is making an erroneous search and not returning the data that is actually in the db. I've checked everything and nothing seems to be wrong with the code I've written.