Answer the question
In order to leave comments, you need to log in
Writes the value undefined Node.js, MySql, how to fix it?
In the console it displays the values correctly, but on the web page it displays the value undefined.
console:
app.get("/order.html", function(request, response){
con.query("SELECT Sum(Cost) FROM Orders", function (err, result, fields) {
if (err) throw err;
console.log(result);
let rezc = '';
fs.readFile("crm/order.html", "utf8", function(error, data){
rezc += '<p>'+result[0].cost+'</p>'; //я так понимаю тут нужно что-то изменить
data = data.replace("{rezc}", rezc);
response.end(data);
});
});
});
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