app.get('/', function(req,res){
con.query('SELECT sum(price) FROM sales', function(err, result, fields){
res.render('index.ejs',{amount:result});
});
});
The above code is for app.js in which i want to render in ejs template to display the result value.
<%= amount %>
above is for the index.ejs and the out put shows {object}{object}. Please i need help to render it correctly Thanks
index.ejs
<%for (var i=0; i<amount.length; i++){ %>
<%= amount[i].total %>
<% } %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.