I tried the above with no luck. But I found in the manual the following that fixed my problem.
$str= stripslashes(strtr($str,"\"",""));//this gets ride of the\
$str= str_replace("'", "''", $str);//this puts ' around the single quotes.
Now the sql insert or update commands work fine.
FYI