$str = 'BEGIN This is a "quote" test. \'Single\' END';
echo $str . "\n";
echo mysql_real_escape_string($str);
// Outputs:
BEGIN This is a "quote" test. 'Single' END
BEGIN This is a \"quote\" test. \'Single\' END
Running PHP 5.3.2 on CentOS. As far as I can remember, mysql_real_escape_string()
will only escape single quotes to prevent sql injections. Double quotes have nothing to do with that, because "
does not start or end a string literal in MySQL!
This is causing backslashes to get inserted into the data! Something I clearly do not want.