Permalink
Browse files

Improve first query example

Show how to access a field inside the first row.

See: http://theroundedengineer.blogspot.de/2012/08/nodejs-and-mysql-library.html
  • Loading branch information...
felixge committed Aug 9, 2012
1 parent e33c1e7 commit f3460775f8784b8570a3bd080ebf24e80247fb65
Showing with 2 additions and 2 deletions.
  1. +2 −2 Readme.md
View
@@ -37,10 +37,10 @@ var connection = mysql.createConnection({
connection.connect();
-connection.query('SELECT 1', function(err, rows, fields) {
+connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
- console.log('Query result: ', rows);
+ console.log('The solution is: ', rows[0].solution);
});
connection.end();

0 comments on commit f346077

Please sign in to comment.