Good day!
Im having a little problem with my nodeJS x MySQL Database.
I connected them together, working fine, im just struggling to insert data, especially inserting a variable such as a project title.
Example:
var titleVariable = "Project1"; INSERT INTO projects (Title) VALUES (titleVariable);
obviously I know that code isnt working like this, but I guess that shows the best whats my problem. Im looking forward for some helpful answers :-) Thank you all already!
Asked
Active
Viewed 309 times
0

Danny
- 3
- 2
-
use `.query('INSERT INTO projects (Title) VALUES (?)', [titleVariable])` its all well documented https://www.npmjs.com/package/mysql#performing-queries – Lawrence Cherone Jul 23 '22 at 13:03
-
thsnls a lot @LawrenceCherone, saved my day :) – Danny Jul 23 '22 at 13:22