codice:
if(get_magic_quotes_gpc() ) { 
echo "Sono attive non serve addslashes";
} else {
$stringa = addslashes($stringa)
}
Quando estrai a prescindere dalle magic_quote... (Servono a mettere, non a togliere il carattere di escape):

.......
$row = mysql_fetch_assoc($result);

$testo = stripslashes($row['testo']);