Codice PHP:
require "config.php";
$link = mysql_connect($host, $dbuser, $dbpass)
or die("Impossibile connettersi al database");
mysql_select_db($dbname)
or die("Impossibile selezionare il database");
mysql_query("set names 'utf8'");
(...)
$txt_it = $_POST["txt_it"];
$txt_it = addslashes($descr_it);
echo $txt_it;
$query = "UPDATE `mytable` SET
txt_it= '$txt_it'
WHERE id = '$id'";
$result = mysql_query($query)
or die(mysql_error());
Questo è il php.
E questo è ciò che restituisce la pagina:
Testo di prova per vedere come funziona l\\'apostrofo
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'apostrofo
(La prima riga è l'echo)