Prima di salvare la stringa nel DB scrivi:
$stringa = addslashes($stringa);

La funzione non fa altro che aggiungere un backslash "\"
Ciao!