Advertisement
Guest User

idk2

a guest
Oct 5th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. //const con = require( "./connection");
  2. const mysql = require( 'mysql');
  3. const conf = require( '../config.json');
  4.  
  5. module.exports = {
  6.   insertIntoDB: (quoteName, messageID, note) => {
  7.     const con = mysql.createConnection({
  8.       host : conf.host,
  9.       user : conf.user,
  10.       password : conf.password,
  11.       database : conf.database
  12.     })
  13.     con.connect(err => {
  14.       if (err) throw err;
  15.       console.log("Connected!");
  16.    
  17.       var sql = "INSERT INTO quotes (quoteName, messageID, note) VALUES (" + quoteName + ", " + messageID + ", " + note + ")";
  18.      
  19.       con.query(sql, (err, result) => {
  20.         if (err) throw err;
  21.         console.log("1 record inserted, ID: " + result.id);
  22.        
  23.       })
  24.     })
  25.   }
  26. }
  27.  
  28. // export function insertIntoDB(quoteName, channelID, messageID, note) {
  29. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement