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

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

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

Post 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.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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`
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Thank you my friend. Your a diamond geezer :)
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

pardon me as i chuckle at "diamond geezer" :lol:
never been called that before
and your very much welcome
Post Reply