"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'中忘記了一些東西。 –