为什么即使我已经将系统与数据库连接,错误仍然显示“插入新数据时出错”?数据甚至无法上传到数据库。
<?php
$newrecord = "";
include('db_novel.php');
if (isset($_POST['submitted'])){
$novel_title = $_POST['novel_title'];
$chapter = $_POST['chapter'];
$genre = $_POST['genre'];
$language = $_POST['language'];
$synopsis = $_POST['synopsis'];
$insert = "INSERT INTO novels (novel_title, chapter, genre, language, synopsis) VALUES ('$novel_title','$chapter','$genre','$language','$synopsis')";
if (!mysqli_query($con, $insert)){
die('error inserting new record');
}//end of nested if statement
$newrecord = "Successfully submitted!";
}//end of the main if statement
?>