"INSERT INTO forum_topics (category_id, poster_id, poster_username, topic_title, topic_content, date) VALUES (".$category_id.", '$poster_id', '$topic_title', '$message', NOW()";
mysql_error()表示语法存在问题,但可能是其他问题。我要发布变量,以便你知道它们来自哪里。
$message = $_POST['topic_message'];
$topic_title = $_POST['topic_title'];
$category_id = $_GET['id'];
修改 将其更改为
$topic_sql = "INSERT INTO forum_topics (category_id, poster_id, poster_username, topic_title, topic_content, date) VALUES (".$category_id.", '$poster_id', '$username', '$topic_title', '$message', NOW())";
然而它仍然不起作用......
答案 0 :(得分:2)
您错过了VALUES
的结束语:
... NOW())";
还有其他问题:
答案 1 :(得分:1)
也许您列出了6列但只提供了5个数据?并且缺少关闭)。
答案 2 :(得分:1)
看起来你错过了一个右括号,只在5列中插入5个值...
INSERT INTO forum_topics (category_id, poster_id, poster_username, topic_title, topic_content, date)
VALUES (".$category_id.", '$poster_id', '$username', '$topic_title', '$message', NOW())
您错过了用户名吗?