CodeIgniter Forums
Using db->like() breaks when using single quotes? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Using db->like() breaks when using single quotes? (/showthread.php?tid=67188)



Using db->like() breaks when using single quotes? - GGitzOle - 01-25-2017

Hi,

I am creating a simple search for a book name. When I use:

$book_name = "John's Apples";

$this->db->like("books.name", $book_name)->get("books");

The query fails to find any results. I tried outputting the query using $this->db->last_query() and it doesn't really show the ' being escaped. Is this a bug? Should I be handling Like data differently?


RE: Using db->like() breaks when using single quotes? - neuron - 01-25-2017

what is column name is it  'books.name' or just 'name'