0

i want to get the location from specific user and when i run this code it gets me error ' Uncaught TypeError: Cannot read property 'location' of undefined ' and i dont know how i can fixed. this is the code :

db.transaction(function(tx){
     tx.executeSql("SELECT location FROM users WHERE username='"+username+"'",[], success ); 
});

function success(tx,results){
     var city = results.rows.item[0].location;
}
1

1 Answer 1

1

You're using square brackets instead of parentheses when you call item on results.rows.

Sign up to request clarification or add additional context in comments.

1 Comment

No problem. Please select this as the answer and have a good day! :-)

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.