标签:
var mysql = require(‘mysql‘; var connection = mysql.createConnection({ host: ‘‘, port: 3306, user: ‘root‘, password: ‘root‘, database: ‘testdb‘ }); connection.connect(function(err){ if(err) console.log(‘err‘); else{
// connection.query(‘select * from suers where sex=:sex‘, {sex:1}, ... connection.query(‘select * from users where sex=?‘, [1], function(err2, rows){ if(err2) console.log(‘query error‘); else {
console.log(rows);
connection.end();
} }); } });
标签:
原文地址:http://www.cnblogs.com/swlin/p/4391790.html