Node.js
0
Вклад в тег
const pool = mysql.createPool({
host : 'localhost',
user : 'root',
password : '',
database : 'chat'
});
pool.getConnection(function(err, connection) {
if(err) {
console.log(err);
}
let sql = "SELECT * FROM `table`";
connection.query(sql, [], function(err, results) {
connection.release(); // always put connection back in pool after last query
console.log(results);
if(err) {
console.log(err);
}
});
});