codeignitor like query with single quote in search string - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: codeignitor like query with single quote in search string (/showthread.php?tid=59300) |
codeignitor like query with single quote in search string - El Forum - 09-18-2013 [eluser]Unknown[/eluser] i have been working on this for like more than 4 hours. i have select query using active record i am doing: $this->db->like('items.name',$search); everything works fine but whenever there is single quote(') in the $search string it gives this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%' OR default_items.short LIKE 'faith\'s%' LIMIT 5' at line 5 I have just checked now that it is adding double back slashes \ instead of single in my active record for LIKE query. i tried in MYSQL bt removing one slash and it is working. i am using pyrocms 2.x. anyone have any idea?Please help Regards Umair |