I want to do a function that tell me if a user is in my database or not. And I cant get the answer.
I tried to do with a function.
function userExist (user) {
con.query("SELECT * FROM users WHERE name=?", [user], function(err, result) {
if(err) throw err;
if(result)
return true
else
return false
});
}
I expected true/false but the output is undefined.