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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -