INSERT INTO fails with node-mysql
I am trying to insert some data with node.js. I have written the following code and installed MySQL support via npm, but I failed to INSERT INTO the table. Here is my code: var mysql = require('mysql'); function BD() { var connection = mysql.createConnection({ user: 'root', password: '', host: 'localhost', port: 3306, database: 'nodejs' }); return connection; } app.post("/user/create", function(req, res) { var objBD = BD(); var post = { username: req.body.username, password: req.body.password }; objBD.query('INSERT INTO users VALUES ?', post, function(error) { if (error) { console.log(error