Node+mysql追加削除を実現


var mysql = require("mysql");
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : 'liyong123.',
  database : 'node'
});
function add(){// 
	var post = {user:'web2',pass:123321,id:2};
	var query = connection.query("INSERT INTO login SET ?",post,(err,results,fields)=>{
		if(err) throw err;
	})
	console.log(query.sql);
	connection.end();
}
function select(){// 
	connection.connect((err)=>{
		if(err){
			console.log(err.stack);
			return;
		}
		console.log(connection.threadId);
	})
	connection.query("SELECT * FROM login",(err,result,firlds)=>{
		if(err) throw err;
		console.log(result)
	})
	connection.end();
}
function update(){// 
	connection.connect((err)=>{
		if(err){
			console.log(err.stack);
			return;
		}
		console.log(connection.threadId);
	})
	connection.query("UPDATE login SET user = ? where id=?",['web12',1],(err,result,firlds)=>{
		if(er