Skip to content

Instantly share code, notes, and snippets.

@reinaldorauch
Created March 2, 2016 00:30
Show Gist options
  • Select an option

  • Save reinaldorauch/5625d51cee1bbc6a7065 to your computer and use it in GitHub Desktop.

Select an option

Save reinaldorauch/5625d51cee1bbc6a7065 to your computer and use it in GitHub Desktop.
Example querying mysql/mariadb on nodejs
(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