PHP MySQL prepared statement - A search with LIKE containing apostrophe not working -
Using a statement prepared with PHP, I have a problem with a query with MySQL here, the explanation here, step by step -Correct (remove refinement, here to focus on search term).
-
I have a website with a search box. Without the bracket, the type of user in a hewer gives some good results: (Bracein de Hiver).
-
The user then searches with the word (de hover) again, nothing is found.
-
The user searches again with 'hiver' and gives the search correctly brasin de weaver.
It seems that there is a problem when apostrophy is used in the search. I go to my code to check any problem. Here a function is called when a search begins:
fetch ()) {$ theBears [$ i] ['id'] = $ col1; $ TheBears [$ i] ['name'] = $ col2; $ I ++; } / * Close details * / $ stmt- & gt; Close (); Returns the $ Bears; } return false; }? & Gt; If I am using phpMyAdmin GUI, then I can easily fix this problem by adding double quotes around the search query: "% searchquery%" but the use of ready statement While doing so, I am unable to do this. Is this?
Note : Any type of search without any type of apostrophy is completely bad.
Let me know if you want a link directly in search for people to check it out.
Comments
Post a Comment