Yihung,
You've got two possible solutions here. I'm guesing that you're enclosing the blob text in single quotes with the sql statement string? You can either change the single quote to a double quote enclosure, or you can addslash the field:
$detail = addslashes($detail);
You're getting error's because mySQL is interpretting the single quote as a string termination char. By double piping the single quote, you are effectively addslashing it so that's why that worked for you. HTH,
Cheers,
Geoff A. Virgo