Answer the question
In order to leave comments, you need to log in
Select query in mySQL from node.js?
I make a request for a selection in the database and in response to the console output "[object Object]"
Here is the script:
const mysql = require("mysql");
const connection = mysql.createConnection({
host:"localhost",
user:"admin",
password:""
});
connection.connect();
connection.query('use callback');
connection.query("SELECT 'msg' FROM NewMessage LIMIT 1", function(err, result){
if(err) return console.log(err);
console.log(result);
});
connection.end(function(err){
if(err) return console.log(err);
console.log("Disconnect");
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question