I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using mysql_real_escape_string to escape special characters but still special characters are saving in the database for a example
Don’t become Don\’t
then i tried htmlspecialchars it is still the same. i even change the db to utf8_general_ci also i tried all togather.
here is the code
$addSearch = htmlspecialchars($search);
$addSearch1 = mysql_real_escape_string($addSearch);
mysql_query("INSERT INTO search (term) VALUES('$addSearch1') ")
or die(mysql_error());
can anyone tell me a solution for this. thanks in advance.
Try like this….