How to access a RowDataPacket object

前端 未结 14 2428
悲&欢浪女
悲&欢浪女 2020-11-29 03:02

I\'m currently developing a desktop application with Node-webkit. During that process I need to get some data from a local MySQL-database.

The querying works fine, b

14条回答
  •  情话喂你
    2020-11-29 03:04

    db.query('select * from login',(err, results, fields)=>{
        if(err){
            console.log('error in fetching data')
        }
        var string=JSON.stringify(results);
        console.log(string);
        var json =  JSON.parse(string);
       // to get one value here is the option
        console.log(json[0].name);
    })
    

提交回复
热议问题