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;
}
Guido
9265 silver badges14 bronze badges
asked Apr 3, 2016 at 19:05
1

1 Answer 1

1

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

answered Apr 3, 2016 at 20:14
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.