Reputation: 155
Does someone knows why the mysql_real_escape_string() function adds three backslashes before quotes, or double quotes, instead of one?
I'm seeing a problem when I retrieve content; there is an extra backslash. This happens only with Aruba MySQL server. On localhost it works great.
Could this be the particular collation? What can I do for this? (Except brute-force removal of the slash?)
Upvotes: 1
Views: 461
Reputation: 26177
Your problem could be that magic_quotes_gpc
is enabled:
It is best to look at your PHP configuration file (php.ini) and make sure it is disabled:
magic_quotes_gpc = Off
if you turn it on and you use mysql_real_escape_string, then you end up double escaping your quotes which is NOT good.
http://www.php-developer.org/best-practices-of-mysql_real_escape_string-function-in-php/
Upvotes: 4