Tahi
Tahi

Reputation: 95

Mysql syntax error server version

Error

INSERT INTO PENILAIAN (ID,KURSUSID,QUEST1,QUEST2,QUEST3,QUEST4,QUEST5,QUEST6,QUEST7,QUEST8,QUEST9,QUEST10)VALUES ('951019105851', ''13'', '1', '2', '3', '4', '4', '5', '4', '5', '4', '5')

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 '13'', '1', '2', '3', '4', '4', '5', '4', '5', '4', '5')' at line 3

code

"INSERT INTO PENILAIAN (ID,KURSUSID,QUEST1,QUEST2,QUEST3,QUEST4,QUEST5,QUEST6,QUEST7,QUEST8,QUEST9,QUEST10)VALUES
('$login_sessionID',
'$kid','$QUEST1','$QUEST2','$QUEST3','$QUEST4','$QUEST5','$QUEST6','$QUEST7','$QUEST8','$QUEST9','$QUEST10')";

Upvotes: 0

Views: 117

Answers (2)

Rafael
Rafael

Reputation: 9

I think you have double quotes on ''13''. olso i want to ask, does any of the values contain quotes? like this (I'am x) if you use quotes you should use mysql_real_escape_string when you POST

Upvotes: 0

Abdulla Nilam
Abdulla Nilam

Reputation: 38609

Error simply guides you

''13''
 ^  ^

there is additional single quote

  1. keep only one ' pair for code
  2. Use prepared statements

Upvotes: 1

Related Questions