Skip to content

Instantly share code, notes, and snippets.

@hackmods
Created November 1, 2017 17:45
Show Gist options
  • Save hackmods/97d320c16a549ab43bd2357898a50dae to your computer and use it in GitHub Desktop.
Save hackmods/97d320c16a549ab43bd2357898a50dae to your computer and use it in GitHub Desktop.
var mysql = require('mysql')
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'Passphrase',
database : 'mydatabase'
});
connection.connect()
connection.query('SELECT * from temp', function (err, rows, fields) {
if (err) throw err
console.log('The solution is: ', rows[2].name , ' ' , rows[2].index)
})
connection.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment