+ 1

Why dows mysql return 0 for the unique code?

I created a php that gets a name and a code from an html form: else{ $sql = "INSERT INTO answer (username, answer) values ('".$_POST["username"]."','".$_POST["code"]."')"; } It properly connects, and writes in the username, but writes 0 for the code value. In the html form, the code has a password type, to hide the written in things so no one can see on the monitor. What could be the problem?

15th Feb 2018, 1:20 PM
Balázs Rippl
Balázs Rippl - avatar
2 Antworten
0
That can have several Problems. First what i want to check is if the column (sql) a Integer or Varchar? Text cant Store into a Integer Field. Hint: NEVER Store POST without Escape into the database (vulnerability)
15th Feb 2018, 2:50 PM
Shin Lin
0
Wow really, it was set on integers... I didnt pay attention to it. And yes, i know, but this is a private survey system, so no one will ,,hack" it, and it doesnt even hold valuable or secret datas. Thank you at all!
15th Feb 2018, 7:34 PM
Balázs Rippl
Balázs Rippl - avatar