Codice PHP:
<?php
$id = $_GET['id'];
$titolo = addslashes($_POST["titolo_post"]);
$data = addslashes($_POST["data_post"]);
$autore = addslashes($_POST["autore_post"]);
$testo = addslashes($_POST["testo_post"]);
$conn = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('blog',$conn) or die(mysql_error());
$query = "UPDATE msg SET id= $id, title= $titolo, date= $data, author= $autore, msg= $testo, WHERE id= $id";
$ris = mysql_query($query,$conn) or die(mysql_error());
header("Location: ./admin.php?start=0");
?>
eseguito il presente script ottengo questo errore di sintassi SQL:
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 '..., date= 20/06/2004, author= Giovanni, msg= Ecco una prova ta
A cosa può essere dovuto? La funz addslashes() dovrebbe eliminare errori relativi a caratteri speciali e inoltre l'errore sarebbe diverso. Qualcuno ha qualche proposta?
Grazie, ciao!