When I use 'insert into news set?', to register at the bank, it is simply not registered
Model:
module.exports = function() {
...
this.salvarNoticia = function(noticia, connection, callback) {
connection.query('insert into noticias set ?', noticia, callback)
}
return this;
}
admin.js:
module.exports = function(application) {
...
application.post('/noticias/salvar', (req, res) => {
var noticia = req.body;
var connection = application.config.dbConnection();
var noticiasModel = application.app.models.noticiasModel;
noticiasModel.salvarNoticia(noticia, connection, function(error, result) {
res.redirect('/noticias');
})
})
}
I'm using the consign, the data coming from the form are all ok, so much so that if I try to register in the bank this way:
connection.query('insert into noticias(titulo, noticia) values ('${dadoRetornadoDoForm.titulo}', '${dadoRetornadoDoForm.noticia}')', dadoRetornadoDoForm, callback)
The registration is usually done, where is the error?
Note: the version of my MySQLServer is 8.0