Reputation: 291
I'm building a server and i'm trying to know if a key is in my sql DB. I want to know if it is possible to get only the value of sql request or do I need to parse it?
function checkKey(key) {
var sqlcheck = "SELECT customerID from authentification where discord_key =
?";
console.log("in function");
DB.query(sqlcheck, [key], function (err, result) {
if (err) throw err;
console.log(result);
});
}
this is what I get :
RowDataPacket { customerID: 'cus_ET5gXP7p7Tafmf' }
but I am looking to get only:
cus_ET5gXP7p7Tafmf
Thank you for your help!
Upvotes: 1
Views: 52
Reputation: 30663
generally
result[0].customerID
however in your example it looks like
result.customerID
Upvotes: 1