php - Error help "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" -


i'm getting error code "you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'condition,location,authorname) values ('','','','','','','','')' @ line 1". i'm new , wondering if 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 * book      title='$title' ");  $checktitle=mysql_num_rows($queryuser);  if($checktitle != 0){ echo "sorry ".$title." added.";  }  else {  $insert_book=mysql_query("insert 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 help.

"condition" keyword in sql.

try this:

 insert book (`isbn`,`title`,`publisher`,`genre`,`availability`,`condition`,`location`,`authorname`) values ('$isbn','$title','$publisher','$genre','$availability','$condition','$location','$authorname') 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -