global.ret;
function executeQuery(dbo, sql) {
dbo.query(sql, function (err, result){
if (err) throw err;
console.log('first:'+result[1]['idUser']);
global.ret= result;
}) ;
console.log('second:'+global.ret[1]['idUser']);
i am trying to access variable result from outside the function but i dont know how to do that. I tried several things with no success, even global variable do not work ! The first console log always works but never the second one. any help would be great
variable result will get data rows from the database. but getting the result out of the function not working. I tried several affectation with return, all of this not working.