dimanche 3 avril 2016

fetch results from sqlite database

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;

          }

Aucun commentaire:

Enregistrer un commentaire