Javascript NodeJS-如何通过执行的查询获得mysql结果?
我是NodeJS的新手(npm安装mysql) 当我尝试执行查询时,如Javascript NodeJS-如何通过执行的查询获得mysql结果?,javascript,mysql,sql,node.js,Javascript,Mysql,Sql,Node.js,我是NodeJS的新手(npm安装mysql) 当我尝试执行查询时,如 connection.query("select ?? from users where id = ?",[["id","fname","lname"],req.body.userid],function (err, rows) { **here I want query which above executed** }); 我想在执行的回调函数中进行查询 我怎样才能得到它 connection.query("s
connection.query("select ?? from users where id = ?",[["id","fname","lname"],req.body.userid],function (err, rows) {
**here I want query which above executed**
});
我想在执行的回调函数中进行查询
我怎样才能得到它
connection.query("select ?? from users where id = ?",[["id","fname","lname"],req.body.userid],function (err, rows) {
res.send(rows);
});
在首选项中,将字符串查询切换为:
"select id,fname,lname from users where id = '"+req.body.userid+"'"
在首选项中,将字符串查询切换为:
"select id,fname,lname from users where id = '"+req.body.userid+"'"
实际上,我希望在回调函数中使用查询。不,我不希望开关参数作为字符串查询。实际上,我希望在回调函数中进行查询。不,我不希望开关参数作为字符串查询。