[英]error with mysql query syntax
"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() says that there is a problem with the syntax, however it might be something else. mysql_error()表示语法有问题,但是可能还有其他问题。 I'm gonna post the variables just so you know where they come from.
我将发布变量,以便您知道它们的来源。
$message = $_POST['topic_message'];
$topic_title = $_POST['topic_title'];
$category_id = $_GET['id'];
EDIT Changed it to 编辑将其更改为
$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())";
However it still doesn't work... 但是它仍然不起作用...
You're missing the closing paren for VALUES
: 您缺少
VALUES
的结尾括号:
... NOW())";
There are other issues: 还有其他问题:
Maybe you list 6 columns but only give data for 5? 也许您列出了6列,但只给出了5列的数据? And missing closing ).
并缺少结束)。
Looks like you're missing a closing parenthesis and only inserting 5 values into 6 columns... 好像您缺少右括号,并且仅将5个值插入6列...
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())
You missing the user name? 您错过了用户名吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.