-
Errore in INSERT
Salve sono service2000. Stavo provando ad inserire dei valori in una tabella del mio database con il seguente codice sql :
insert into domande (NULL,'chi sono', 'sono io','2010-05-05',1,'')
Purtroppo mi dà un errore di sintassi sql ed io non sono riuscito a risolverlo. Potete aiutarmi?
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 'NULL,'chi sono', 'sono io','2010-05-05',1,'')' at line 1
grazie.
-
La sintassi corretta è:
Codice PHP:
$query = "INSERT INTO MyTable SET var0='2', var1='valore1', var2=now(), ecc...";
oppure
Codice PHP:
$query = "INSERT INTO MyTable (var0, var1, var2) VALUES ('2', 'valore1', now())";
o
$query = "INSERT INTO MyTable VALUES ('2', 'valore1', now())";
-
grazie era un value che non avevo messo, adesso funziona tutto.:lol: