SHARE
TWEET

Untitled

a guest Aug 18th, 2018 413 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mysql = require('mysql');
  2.  
  3. var con = mysql.createConnection({
  4.   host: "localhost",
  5.   user: "root",
  6.   password: "sistemas2018",
  7.   database: "cursoReact"
  8. });
  9.  
  10. con.connect(function(err) {
  11.   if (err) throw err;
  12.   console.log("Connected!");
  13.   var sql = "INSERT INTO members (name, surname, email) VALUES ?";
  14.   var values = [
  15.     ['John', 'Hannah', 'hanna@gmail.com'],
  16.     ['Peter','Pan', 'Lowstreet4@hotmail.com'],
  17.     ['Amy', 'Apple', 'abcd@st652.net'],
  18.     ['Hannah','Montana', 'Mountain21@haiku.io'],
  19.     ['Michael', 'Mercado', 'oxxo@Valley345.sex'],
  20.     ['Sandy', 'Ocean', 'cougar@blvd2'],
  21.     ['Betty','La fea', 'asde@GreenGrass.com'],
  22.     ['Richard', 'Sky st 331', 'abed@dsddas.com'],
  23.     ['Susan', 'One way 98', 'abed@dsddas.com'],
  24.     ['Vicky', 'Yellow', 'Garden@2222.com'],
  25.     ['Ben', 'Park Lane', 'ascd@38.net'],
  26.     ['William', 'Central', 'a@as.amd'],
  27.     ['Chuck', 'Main', 'sas@road.net'],
  28.     ['Viola', 'Marson', 'loco@Sideway.io']
  29.   ];
  30.   con.query(sql, [values], function (err, result) {
  31.     if (err) throw err;
  32.     console.log("Number of records inserted: " + result.affectedRows);
  33.   });
  34. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top