I used htmlspecialchars on column at my database called ‘Description’.
I got search page in my website which return results using this mysql_query sentence:
“SELECT * FROM db.db WHERE NameOfEvent LIKE ‘%”.$q.”%'”
I added the following string to the database: “test&test“.
because I used htmlspecialchars, in the database it will look like this: “test&test“
If I type ‘a’ at the search, test&test will be one of the results… how can I avoid it?
Don’t save your values with
htmlspecialchars(). This should be used for output/display.If you must, consider doing so in an additional column, i.e.
formatted_description. This way you can still search ondescription.Probably not the answer you want. But…