devo inserire 3 dati: from, to e msg
creo la connessione e la query
<?
session_start();
$connection=mysql_connect("...")or die("non trovo il database");
$scegli_db=mysql_select_db(---,$connection) or die ("non trovo la tabella");
$from = $_SESSION['nickname'];
$to=$_GET['to'];
$msg = $_POST['msg'];
if ($to == "") {
echo "Non hai inserito il campo destinatario:";
} else {
$a = "INSERT INTO mess (from, to, msg) VALUES ('$from','$to','$msg')";
$b = mysql_query($a) or die (mysql_error());
echo "<h2> Messaggio inviato con successo a $to</h2>"; header("Location: index2.php");}
?>
però mi da l'errore:
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 'from, to, msg) VALUES ('Redazione','lupin30','aaa')' at line 1
dove sta l'inghippo?