0

Every time i use a apostrophe in my query its saving with a Backslash. I'm saving everything in UTF-8.

This is my code

$mysqli->escape_string($_POST['title']);

And I also tried

$mysqli->escape_string(htmlentities($_POST['title']));

But every time its saving Backslash and apostrophe \'

Can anyone point me out the problem. Also this is not happning on my localhost while using xampp for windows. its happening in my hosting server which is bluehost.

zack
  • 484
  • 3
  • 9
  • 25
  • 3
    It's possible that they have [`magic_quotes`](http://www.php.net/magic_quotes) enabled. Check with `phpinfo()`. – rid Dec 13 '13 at 08:42
  • 1
    You can avoid this escaping hassle by passing your variables to MySQL by way of [parameters to prepared statements](http://stackoverflow.com/a/60496). – eggyal Dec 13 '13 at 08:54
  • @eggyal it won't solve the very problem with magic quotes though – Your Common Sense Dec 13 '13 at 10:13
  • @YourCommonSense: True (assuming, of course, that the problem in this case is indeed `magic_quotes`). – eggyal Dec 13 '13 at 10:15

0 Answers0