PDA

View Full Version : MySQL error


filburt1
09-14-2002, 10:24 PM
I got this:

SQL-query :

INSERT INTO news (what, when) VALUES ('test', NOW())


MySQL said:


You have an error in your SQL syntax near 'when) VALUES ('test', NOW())' at line 1

My database:

mysql> describe news;
+-------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| when | timestamp(14) | YES | | NULL | |
| what | text | | | | |
+-------+---------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

Aroo?

filburt1
09-15-2002, 02:55 PM
BTW no, this isn't vB code, just something I'm trying out for myself.

filburt1
09-15-2002, 02:56 PM
D'oh! when is a keyword! http://www.mysql.com/doc/en/Reserved_words.html :angry:

Admin
09-15-2002, 02:58 PM
Try inserting a value only into what, and then only into when. See what's giving you the error.