TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
durgaprasad rapolu
NA
57
8.8k
How to return the value out side of the query function nodjs
Apr 19 2019 2:43 AM
I am trying to get the value from mysql using node.js. Now i want to that value display out side of the query function
I am trying this code :
var someVar=[];
con.query('SELECT Mobiles from Salestb' , function (err,rows,callback) {
if(err) {
throw err;
} else {
setValue(rows[0].Mobiles);
}
});
function setValue(value) {
someVar = value;
console.log(someVar);
}
console.log(someVar);
But it shows Null Value
Reply
Answers (
1
)
How to display the Mysql value out of the function in nodejs
Is it possible local variable value store as a instance var