I am using mysql on node.js to get an id from some table .And now i wants to store that id in variable.
con.query("SELECT user_id FROM owners where id =?", [ownerId] , function (err, result, fields) {
let id=result;
console.log(id);
if(err) throw err;
//console.log(result);
res.send(result);
});
I works perfectly and gets data from server but it stores th value in id is like [ RowDataPacket { user_id: 1642 } ]
. But i want my id as only "1642" so that i can use some conditions. Kindl help