Skip to content

Instantly share code, notes, and snippets.

@KuJoe

KuJoe/app.js Secret

Created September 14, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KuJoe/7615a1448d7ec4cb44ae5e504a9f1652 to your computer and use it in GitHub Desktop.
Save KuJoe/7615a1448d7ec4cb44ae5e504a9f1652 to your computer and use it in GitHub Desktop.
function getRuin(data, callback) {
var con = mysql.createConnection({
host: cfg.host,
user: cfg.user,
password: cfg.password,
database: cfg.database
});
con.connect();
console.log("3");
con.query("SELECT ruin FROM ruins ORDER BY RAND() LIMIT 1", function (err, result) {
console.log("4");
// if (err) throw err;
var msg = result[0];
// console.log(msg.ruin);
return callback(msg.ruin);
con.end();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment