I am calling a function that inserts a row into MySQL. this is inside of a loop, but it gives me the error. Error: Cannot enqueue Handshake after already enqueuing a Handshake.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "fleet.iad1-mysql-e2-20a.dreamhost.com",
user: "seesi",
password: "saml3651",
database: "bazaar_data"
});
function run(){
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
//Insert a record in the "customers" table:
var sql = "INSERT INTO Bazaar_Orders_Price (name, address, city, state) VALUES ('jeff', 'your face', 'Chicago', 'IL')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});
}
for(i=0; i<5; i++) {
run()
}