javascript - The selection of specific fields from an array of js -
client.query("select * rooms token = ?", [data.token], function(err, results, fields) { callback(results); console.log(results); });
this query returns result array. how can necessary fields?
looking @ comment, if json object -:
[ { "bump":"1376149484", "user":"alex", "token":"11569", "active":0 } ]
you can iterate through object -:
for (var in results) { console.log('bump = ' + results[i].bump); console.log('user = ' + results[i].user); console.log('token = ' + results[i].token); console.log('active = ' + results[i].active); }
Comments
Post a Comment