Ho creato un file chiamato funzione.php che viene incluso nel file che dalva i dati nel db
Il campo si chiama (testo)
Codice PHP:
function strip_magic ($value)
{
    
$value = (get_magic_quotes_gpc()) ? stripslashes($value) : $value;
    return 
$value;
}

$testo strip_magic($_POST['testo']); //ATTENZIONE: i campi di input vanno validati attentamente!!
$testoDb mysql_real_escape_string($testo,$conn); 
Questo invece è il file che salva i dati nel db
Codice PHP:
include "funzione.php";
$testo stripslashes($testo);
$testo nl2br($testo);
$testo htmlspecialchars($testo,ENT_QUOTES);
$testo ereg_replace("<br />","
"
,$testo);
$testo ereg_replace("<br>","
"
,$testo);
$testo ereg_replace("<b>","[b]",$testo);
$testo ereg_replace("</b>","[/b]",$testo);
$testo ereg_replace("&lt;","<",$testo);
$testo ereg_replace("&gt;",">",$testo);
$testo ereg_replace("'","’",$testo); 
Ma quando inseriscouna stringa racchiusa tra virgolette non me la salva