r/PHPhelp • • Oct 13 '19

INSERT INTO sql table not working.

Am I inserting rows into my table correctly? This doesn't work for some reason.

$conn->exec("INSERT INTO Questions_Table (ID, Question, Votes) VALUES ($num_rows, $submitted_question, 1)");
9 Upvotes

9 comments sorted by

View all comments

6

u/akas84 Oct 13 '19

You are missing quotes in the string and you should check how to bind params or you will have and sql injection on there.