Skip to content

Commit f346077

Browse files
committed
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
1 parent e33c1e7 commit f346077

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ var connection = mysql.createConnection({
3737

3838
connection.connect();
3939

40-
connection.query('SELECT 1', function(err, rows, fields) {
40+
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
4141
if (err) throw err;
4242

43-
console.log('Query result: ', rows);
43+
console.log('The solution is: ', rows[0].solution);
4444
});
4545

4646
connection.end();

0 commit comments

Comments
 (0)