but I am getting a error
Code: Select all
totalQuestions=10;
$i=0;
while ($i <= $totalQuestions-1):
// GET VARS
$question_ID = $_POST['question_ID'.$i];
$answers = $_POST['answers'.$i];
// INSERT
$MySQL_InsertUsers = mysql_query("
INSERT INTO UsersAnswers (
QuizID, UserID, question_ID, answers
) VALUES (
'$Quiz_ID' , '$UserID', '$question_ID', '$answers'
)"
, $ctech_con);
$i++;
endwhile;
ERROR
Error
SQL query:
INSERT INTO UsersAnswers( QuizID, UserID, question_ID, answers )
VALUES (
'17', '22', '24', '0'
)
INSERT INTO UsersAnswers( QuizID, UserID, question_ID, answers )
VALUES (
'17', '22', '23', '0'
)
INSERT INTO UsersAnswers( QuizID, UserID, question_ID, answers )
VALUES (
'17', '22', '20', '0'
)
MySQL said:
#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 'INSERT INTO UsersAnswers ( QuizID, UserID, question_ID, answers ) VALUES ( '17' ' at line 3