usa la funzione addslashes() sulla stringa.