0
How do I pass these arguments inside CALL? When I put 9 random values inside LET sql("..."), it runs, but passing this way returns this error. I followed this tutorial -> https://www.mysqltutorial.org/mysql-nodejs/call-stored-procedures/ But it does not teach how to pass more than one argument, if anyone can help me I thank. (Note: I am beginner)
Code:
router.post('/pedido_final', function(req, res){
let connection = mysql.createConnection({
host: 'localhost',
port: 3309,
user: 'root',
password: 'XXXXX',
database: 'XXXXX'
});
let sql = `CALL recebePedido(?)`
let dados = [req.body[0].nMesa, req.body[0].idProd, req.body[0].Quantidade,
req.body[0].codFun, req.body[0].p, req.body[0].sabores, req.body[0].nomeCli, req.body[0].nmrCelCli,
req.body[0].Obs]
connection.query(sql, dados, (error, results, fields) => {
if (error) {
return console.error(error.message);
}
console.log(results[0]);
});
connection.end(); });