How do you guys use node js vars. Please refer to red marking. I am
declaring variable at one place trying to use at another place, simply not
working.
function login(email,password){ // Returns the login data row
var email = email.trim().toLowerCase();
var password = password.trim();
var result = []; //*Declaring here*
//var queryString = "SELECT * FROM users where Email ="+"'"+email+"'"+
AND Password = +"'"+password+"'";
var queryString = "SELECT * FROM users where Email ="+"'"+email+"' AND
Password = '"+password+"'";
//var execQuery = function execQuery(){
con.query(queryString,function(err,rows){
if(err) throw err;
// console.log('Data received from Db:\n');
//result = result.push('SUCCESS','0000','Data',rows)
//console.log(rows);
result = rows; // *Want to use here*
//return rows;
});
con.end();
//}
//console.log('Outside function block: '+execQuery());
return result; /*/ want to see here*
}
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/306be370-1c7e-474e-93f9-0069bf6ff190%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.