I'm using PHP PDO there is syntax error in MySQL. Here is my query:
INSERT INTO g_question
(gender,
age,
marital_status,
feeling_about_life,
how_happy,
first_time,
disorders,
disorders_treat,
optional)
VALUES (:gender,
:age,
:marital_status,
:feeling_about_life,
:how_happy,
:first_time,
:disorders,
:disorders_treat,
:optional)
ERROR
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 ':gender, :age, :marital_status, :fe' at line 11
try this:
INSERT INTO g_question
(gender,
age,
marital_status,
feeling_about_life,
how_happy,
first_time,
disorders,
disorders_treat,
optional)
VALUES ($gender,
$age,
$marital_status,
$feeling_about_life,
$how_happy,
$first_time,
$disorders,
$disorders_treat,
$optional)
My comment hit the nail on the head:
I bet you're either doing a
->query
instead of a->prepare
, or using mysqli instead of PDO driver.