I've got the function getName in my db.js
function getName(uid){
db.all("SELECT name FROM table WHERE uid = ? ", function (err){
if(err){
console.log(err);
}else{
console.log(this);
}
});
}
and I want to get the name and save it to var name in another file.
var uid = req.session.user;
var name = db.getName(uid);
console.log(name);
what is wrong about the db function getname why do I get undefined? Would be great if you could help me!