Page 1 of 1

Eh! Wha! I can't INSERT this...

Posted: Tue Oct 08, 2002 7:03 pm
by Gen-ik
Apparently I have this error..

You have an error in your SQL syntax near 'from, main) VALUES ('2', '09.10.2002', 'Si', 'Hello')' at line 1

..from this code..

mysql_query("INSERT INTO vforum (idnum, date, from, main) VALUES ('$thisid', '$thisdate', '$thisname', '$thistext')");

..and I know the connection to the database is ok because I have working mysql_querys before this line of code.

I can't see the problem and was wondering if anyone else could?


Thanks.


PS. The variables are all ok as well because I printed them to make sure they were there.. and they were.

Posted: Tue Oct 08, 2002 7:14 pm
by mydimension
the word "from" is a reserved word is SQL language. if you want to use it as a field name then enclose from in backticks (under the tilde ~) like so : `from`

Posted: Tue Oct 08, 2002 7:16 pm
by Gen-ik
Thank you my friend. Your a diamond geezer :)

Posted: Tue Oct 08, 2002 7:20 pm
by mydimension
pardon me as i chuckle at "diamond geezer" :lol:
never been called that before
and your very much welcome