I am encountering one little problem here:
I am entering one MySQL query through PHP. I have checked the connection works fine and looks like the following:
INSERT INTO table (q1,q2,q3) VALUES ('".$_POST['Q1']."', '".$_POST['Q2']."'...)
then when I change the query to the following, there is an error:
INSERT INTO table (q1,q2,q3-1) VALUES ('".$_POST['Q1']."', '".$_POST['Q2']."'...)
The following error appears:
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 ‘-1) VALUES (‘N’, ‘asdfasdf’, ” )’ at line 1
Now, I am thinking, is it because:
- I name the table column as ‘q3-1’
- or any other problem?
Would it be okay if I change it to q3_1 instead?
You have error in your second query because of
q3-1. It should be in quotes :