0

I'm new to node and javascript. Sorry if this is an obvious question.

I retrieve data from mysql using the node,js code below:

     var quer = connection.query('select password from users where  mail="'+ so +'" ',function(err, result, fields){

               console.log(result);

        });

Result is this

    [{password:'123456'}]

I want to get it as only 123456, how can I achieve that?

1
  • 5
    result is an array that contains an object with a password, it's not JSON. So console.log(result[0].password) should do it. Commented Feb 16, 2014 at 17:27

1 Answer 1

2

It's easy:

console.log(result[0].password)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.