我的代码出现此错误“您的 SQL 语法有错误;请查看与您的 MySQL 服务器版本相对应的手册,以获取正确的语法以在 'condition,location,authorname) VALUES ('','' ,'','','','','','')' 在第 1 行”。我是新手,我想知道是否有人可以帮助我找出问题所在?代码:
<?PHP
include_once('header.php');
include_once('create.php');
$isbn=$_POST['isbn'];
$title=$_POST['title'];
$publisher=$_POST['publisher'];
$genre=$_POST['genre'];
$availability=$_POST['availability'];
$condition=$_POST['condition'];
$location=$_POST['location'];
$authorname=$_POST['authorname'];
$queryuser=mysql_query("SELECT * FROM book
WHERE Title='$title' ");
$checktitle=mysql_num_rows($queryuser);
if($checktitle != 0){
echo "Sorry ".$title." is already added.";
}
else {
$insert_book=mysql_query("INSERT INTO book (isbn,title,publisher,genre,availability,condition,location,authorname) VALUES ('$isbn','$title','$publisher','$genre','$availability','$condition','$location','$authorname')");
if($insert_book)
{ echo "<b>Addition successful.</b><br><b>You Added: </b>".$title."<br><b>By:
</b>".$authorname ; }
else{
echo "error in registration".mysql_error();
}
}
提前感谢您的帮助。