0
I’m not able to return value in function, I know it’s wrong, but I’ve made several unsuccessful attempts. The query is being performed and brings the password, the problem is to return this value to whoever executed the function:
function obtemSenha() {
var read_R = 'select * from senha';
var ret = 0;
connect.getConnection(function(err, connection){
connection.query(read_R, function(err, data, fields){
if(err) throw err;
else {
console.log(`SenhaREC....0: ${data[0].senha}`);
ret = data[0].senha;
connection.release();
}
});
});
return ret;
};
var senha = obtemSenha();
It worked!!! Thanks!!!
– Developer