Hi,
I am working on a survey which results will be saved into a MySQL Database.
When I submit the form it is giving me this error:
"You have an error in your SQL syntax near 'EXPLAIN) VALUES ('Question, '3', 12345, NULL)' at line 1"
Some of this value are send in a hidden field and other are typed by the user.
"Question" is a hidden, "3" is chosen by the user, "12345" y the client ref number which is hidden, and NULL is the explanation (the error).
The form has two types of question :radio groups form 0 to 10 and a text area to explain the choice of the radio group.
If I take the explain part out everything works fine and updates into the db but as soon as I put the text area in it gives me the previous error.
The statement is like this:
if ((isset($HTTP_POST_VARS["MM_insert"])) && $HTTP_POST_VARS["MM_insert"] == "form2") {
$insertSQL = sprintf("INSERT INTO survey1typeq2 (QUESTION, ANSWER, CLIENT, EXPLAIN) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['QUESTION'], "text",
GetSQLValueString($HTTP_POST_VARS['ANSWER'], "text",
GetSQLValueString($HTTP_POST_VARS['CLIENT'], "int",
GetSQLValueString($HTTP_POST_VARS['EXPLAIN'], "text");
Any help will be very appreciated.
Thanks,
sbayter
I am working on a survey which results will be saved into a MySQL Database.
When I submit the form it is giving me this error:
"You have an error in your SQL syntax near 'EXPLAIN) VALUES ('Question, '3', 12345, NULL)' at line 1"
Some of this value are send in a hidden field and other are typed by the user.
"Question" is a hidden, "3" is chosen by the user, "12345" y the client ref number which is hidden, and NULL is the explanation (the error).
The form has two types of question :radio groups form 0 to 10 and a text area to explain the choice of the radio group.
If I take the explain part out everything works fine and updates into the db but as soon as I put the text area in it gives me the previous error.
The statement is like this:
if ((isset($HTTP_POST_VARS["MM_insert"])) && $HTTP_POST_VARS["MM_insert"] == "form2") {
$insertSQL = sprintf("INSERT INTO survey1typeq2 (QUESTION, ANSWER, CLIENT, EXPLAIN) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['QUESTION'], "text",
GetSQLValueString($HTTP_POST_VARS['ANSWER'], "text",
GetSQLValueString($HTTP_POST_VARS['CLIENT'], "int",
GetSQLValueString($HTTP_POST_VARS['EXPLAIN'], "text");
Any help will be very appreciated.
Thanks,
sbayter