I'm trying to save the returned data from MySQL to a local variable,
This is what I tried
const queryUser = "SELECT * FROM Users WHERE email = ?";
var userFound;
db.query(queryUser, [email], (err, result) => {
userFound = result;
(result returns an array with one object on it)
});
console.log(userFound) returns undefined;
But it's returning me undefined