$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.
If the ANSI_QUOTES SQL mode is
enabled, string literals can be quoted
only within single quotation marks
because a string quoted within double
quotation marks is interpreted as an
identifier.