"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()表示语法有问题,但它可能是别的。我会发布变量,以便知道它们来自哪里。mysql查询语法错误
$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())";
然而,它仍然无法正常工作......
它说错误是在哪里?你能发布实际的错误信息吗? – Mike
*不要*在SQL查询中直接使用'$ _POST'和'$ _GET'! –
尝试回显您的SQL查询,这应该可以帮助您找到语法错误。提示:你在'VALUES'中忘记了一些东西。 –