$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.
Sounds like magic quotes got turned on.
This post details your problem exactly, along with fixes. http://www.sitepoint.com/forums/showthread.php?t=545824
"
does start a string in MySQL. (See: Strings)
Exception:
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.