I'm facing this error while inserting some data to our database. My code for inserting data is below.The whole error message is:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 '','nmnm','Female','01/06/2017','info@example.com','9999999999')' at line 1' in /home/avfswallet/pancard.avfswallet.com/user.php:35 Stack trace: #0 /home/avfswallet/pancard.avfswallet.com/user.php(35): PDO->query('INSERT INTO use...') #1 {main} thrown in /home/avfswallet/pancard.avfswallet.com/user.php on line 35
$category=$_POST['category'];
$req_type=$_POST['requestType'];
$lname=$_POST['last_name'];
$fname=$_POST['first_name'];
$mname=$_POST['middle_name'];
$gender=$_POST['iCheck'];
$birth=$_POST['dob'];
$email=$_POST['email'];
$phone=$_POST['phone'];
echo $category."<br/>";
echo $req_type."<br/>";
echo $lname."<br/>";
echo $fname."<br/>";
echo $mname."<br/>";
echo $gender."<br/>";
echo $birth."<br/>";
echo $email."<br/>";
echo $phone."<br/>";
$query="INSERT INTO users (app_category,user_title,last_name,first_name,middle_name,gender_type,dob,email_id,phone_no) VALUES('{$category}','{$req_type}','{$lname}',{$fname}','{$mname}','{$gender}','{$birth}','{$email}','{$phone}')";