私はいたるところを見てきましたが、この質問に対する答えが見つかりません。人々を助けてきた解決策をいくつか見てきましたが、試してみると、すべてが正しく行われており、修正する必要がないことがわかります。私はフォーラムを作成しており、これらをmysqlテーブルに挿入しようとしていますが、試すたびに次のように表示されます:
「フィールド リスト」の不明な列「6c09e4fe82d47011bf9b25b05946307f」。
長いコードはユーザーの 1 人のユーザー ID であり、挿入されるはずですが、何らかの理由でその名前の列を探しています。最初のクエリでエラーが発生しただけなので、2 番目の部分はまったく問題ないかもしれませんが、わかりません。
$sql = "INSERT INTO
topics(topic_subject,
topic_date,
topic_cat,
topic_by)
VALUES('" . mysql_real_escape_string($_POST['topic_subject']) . "',
NOW(),
" . mysql_real_escape_string($_POST['topic_cat']) . ",
". $_SESSION['userid'] ."
)";
$result = mysql_query($sql);
if(!$result)
{
//something went wrong, display the error
echo 'You did everything right, yet there is an error. WEIRD RIGHT???<br /><br />' . mysql_error();
$sql = "ROLLBACK;";
$result = mysql_query($sql);
}
else
{
//the first query worked, now start the second, posts query
//retrieve the id of the freshly created topic for usage in the posts query
$topicid = mysql_insert_id();
$sql = "INSERT INTO
posts(post_content,
post_date,
post_topic,
post_by)
VALUES
('" . mysql_real_escape_string($_POST['post_content']) . "',
NOW(),
" . $topicid . ",
". $_SESSION['userid'] ."
)";
$result = mysql_query($sql);