Topic: An SQL syntax error of some sort- Help appreciated

I'm working on a comment system for the news updates on my site. In doing so, I want the article, let's say it is 1.php, to have a table in the comments database called 1.

The table is $commenttable. However, when I tried writing a comment, I get an error message, which says something about the syntax on this line. I'm guessing the problem is a $commenttable. Any ideas or something that stands out? I can't figure out what the error is. The page is at http://gamesource.biz/news/1.php.

mysql_query("INSERT INTO $commenttable SET name = '$name', comment ='$comment', time = '$time', email = '$email', ip = '$ip'") or die(mysql_error());

2 (edited by Smartys 2005-11-20 11:47)

Re: An SQL syntax error of some sort- Help appreciated

You're mixing up the syntax for update and insert wink
The code should look like:

mysql_query("INSERT INTO $commenttable (name, comment, time, email, ip) values ('$name', '$comment', '$time', '$email', '$ip')") or die(mysql_error());

Re: An SQL syntax error of some sort- Help appreciated

'$ip'")

shouldn't it be

'$ip')")

?

Re: An SQL syntax error of some sort- Help appreciated

Yup, my mistake tongue
Edited wink