I get an error when sending a request to this endpoint: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = 3' at line 1" Server on node.js. Tell me where is the error?
app.put('/changetable', (request, response) => {
if (!request.body) return response.sendStatus(400);
const key = request.body.key;
const col1 = request.body.col1;
const col2 = request.body.col2;
const col3 = request.body.col3;
const col4 = request.body.col4;
pool.query(`UPDATE tables set col1=?, col2=?, col3=?, col4=? WHERE key=?`, [col1, col2, col3, col4, key], function (err, result) {
if (err) return console.log(err);
});
response.send(`Table edited`);
});