这个问题我已经有好几天了,我似乎看不出问题出在哪里。我已经以多种方式查看了这些功能,甚至查找了 php 站点,但我仍然无法解决这个问题。这是我遇到问题的代码:
$sql = mysqli_query($db_connect, "INSERT INTO forum_post(post_author, post_author_id, date_time, type, section_title, section_id, thread_title, post_body) VALUES($log_username, $log_id, now(), 'a', '$forum_section_title', '$forum_section_id', '$post_title', '$post_body')");
$this_id = mysqli_insert_id($db_connect);
header("location: ../view_thread.php?id=$this_id");
编辑...
所以我可以展示我是如何处理错误的(而不是我可以看到消息):
$sql = mysqli_query($db_connect, "INSERT INTO forum_post(post_author, post_author_id, date_time, type, section_title, section_id, thread_title, post_body) VALUES('$log_username', '$log_id', now(), 'a', '$forum_section_title', '$forum_section_id', '$post_title', '$post_body')");
if(mysqli_error($db_connect)) {
$message = mysqli_error($db_connect);
header("location: ../message.php?msg=$message");
}
$this_id = mysqli_insert_id($db_connect);
header("location: ../view_thread.php?id=$this_id");
exit();