Skip to content Skip to sidebar Skip to footer

Trying To Get A String As The Output Of Sql Query

con.query('SELECT location FROM TOC WHERE name = 'The Story'', function(err, value){ console.log('Data received from Db:\n'); console.log(value); This gives me the

Solution 1:

If you just want a string of the data you can JSON.stringify(value[0]) and log that.

You can also access the value of location by using value[0].location, the RowDataPacket should be an object where each column is a property of said object, and the value from the row is the value of the property

Post a Comment for "Trying To Get A String As The Output Of Sql Query"