Created
March 2, 2016 00:30
-
-
Save reinaldorauch/5625d51cee1bbc6a7065 to your computer and use it in GitHub Desktop.
Example querying mysql/mariadb on nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (argument) { | |
| var mysql = require('mysql'); | |
| var db = mysql.createConnection('mysql://root:amigen@localhost/bestuse_main'); | |
| db.query('SELECT * FROM customers', function (err, res) { | |
| if (err) { throw err; } | |
| for (var i = 0; i < res.length; i++) { | |
| console.log(res[i].orgname); | |
| } | |
| db.end(); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment