Per quale motivo non mi funzionano queste due query? Ho sbagliato qualcosa nella sintassi?
Codice PHP:
$IDSc = intval($_GET['IDSc']);
$n = addslashes($_POST['n']);
$c = addslashes ($_POST['c']);
$g = addslashes ($_POST['g']);
$h = addslashes ($_POST['h']);
$i = addslashes ($_POST['i']);
$j = addslashes ($_POST['j']);
$q="select FkEn from sc where IDSc='$IDSc'";
$IDEn=mysql_query($q);
$query = "UPDATE en2 SET
n = $n,
c = $c,
g = $g,
h = $h,
i = $i,
j = $j
WHERE IDEn = '$IDEn'";
Ecco l'errore:
Errore nella query UPDATE en2 SET n = 2, c = 2, g = 2, h = 2, i = 2, j = 2 WHERE IDEn = 'Resource id #7': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use.