Error in sql syntax

  • updated
  • Answered

when i tried to add this to the db it shows this => 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 ')' at line 5. I dont know what is my error.

Here is my codes

The author has been inserted successfully!";

$message .= "Name:
" . $author_name . "


$message .= "Gender:
" . $gender_id . "


$message .= "Add Another Item";

} else {

$message .= "Error occurs in inserting item record.

Try Again";



  • Profile
  • Add/Edit Books
  • Add/Edit Authors
  • Edit Profile & Settings

#container1 {

background-color: #e2dada;

opacity: 0.9;

border-radius: 2em;


.centered-form {

margin-top: 120px;

margin-bottom: 120px;


.centered-form .panel {

background: rgba(255, 255, 255, 0.8);

box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;



Sorry for the problem with your SQL code. The code you're listing is for the most part PHP, but if you look at the database query lines, you can see that one of the variables isn't quoted like the others. That would be our guess for where the problem is occurring. You should try to run the query in it's pure form in the database and see if that isn't the problem. Otherwise, you will need to consult with a programmer/developer to help diagnose where the code is not working properly.

I hope this helps to answer your question, please let us know if you require any further assistance.

Arnel C.