I'm getting this error with my code "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition,location,authorname) VALUES ('','','','','','','','')' at line 1". I'm new to this and i was wondering if anyone could help me figure out what's wrong? Code:
<?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();
}
}
thanks in advance for any help.