So I've been using node.js and mysql for a while now but I've run into a new issue. I know I made the title seem basic but I just have no idea how I can title this question. So let's say I have:
connection.query(SELECT column FROM table, function(err, result) {
if (err) {
console.log(err)
}
if (result.length > 0) {
console.log(result[0].thisNeedsToBeAVar)
}
})
now in most cases, I would just use result[0].column
and it's all good. But the entire issue is that column
could be anything in my case. So I have that column as a var. How do I use it when I log the result? If I simply put the var there, it thinks that the column's name is literally whatever the var is called...