Welcome Guest, Not a member yet? Register   Sign In
codeignitor like query with single quote in search string

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

Theme © iAndrew 2016 - Forum software by © MyBB