Answer the question
In order to leave comments, you need to log in
How to return a value from an asynchronous function?
There is a function
function authcheck(from_id,first_name){
conn.query("SELECT * FROM `users` WHERE `id` = '"+from_id+"'", function(err, results) {
if (err){
console.log(err); return false;}
var result = JSON.parse(JSON.stringify(results));
if ( result[0] === undefined ){
conn.query("INSERT INTO `users` (`id`,`name`,`balance`) VALUES ('"+from_id+"','"+first_name+"','0');", function(err, results){
if (err){
console.log(err); return false; }
return 'unf';
});
return false;
}else{
return ['jopa']
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question