标签:nod ror pass inf res nodejs script cti params
//连接数据库 var mysql = require(‘mysql‘); var connection = mysql.createConnection({ host: ‘bdm253137448.my3w.com‘, //数据库地址 user: ‘bdm253137448‘, //数据库用户名 password: ‘muchengfeng123‘, //数据库管理密码 database:‘bdm253137448_db‘, //数据库名称 insecureAuth: true }); connection.connect(function(err) { if (err) { console.error(‘error connecting: ‘ + err.stack); return; } console.log(‘connected as id ‘ + connection.threadId); }); var userModSql = ‘UPDATE userinfo SET username = ?,pwd = ? WHERE id = 1‘; var userModSql_Params = [‘Hello World‘,99]; //改 up connection.query(userModSql,userModSql_Params,function (err, result) { if(err){ console.log(‘[UPDATE ERROR] - ‘,err.message); return; } console.log(‘----------UPDATE-------------‘); console.log(‘UPDATE affectedRows‘,result.affectedRows); console.log(‘******************************‘); }); //关闭连接 connection.end();
标签:nod ror pass inf res nodejs script cti params
原文地址:http://www.cnblogs.com/muamaker/p/6808255.html