Search code examples
phpmysql-real-escape-string

mysql_real_escape_string distorts user input - how to fix


I have all my inputs from the user (that end up in a mysql table) go through mysql_real_escape_string() per php.net and most forum users. I honestly don't know what it does internally.

What I do know is that running on my xampp light installation it does not effect the user input, but when I upload to my production Linux server it adds a '\' to the user input whenever the user uses an apostrophe such that It's becomes It\'s.

What is the fix for this?


Solution

  • You have magic_quotes enabled on your remote server. Disable it.