Monday 1 May 2017

How can I show data on mysql with nodejs and expressjs

app.js

function showConnect(req, res){

    mysql_crawl.query('SELECT full_price, discount_price, quantity, prod_link, images, prod_desc, status FROM `catalogsearch_fulltext` WHERE MATCH(data_index) AGAINST("ครีม") LIMIT 0 , 10', function(error, rows){
    res.render('product.html',{related: rows})

    })

product.html

<%
for (var i of related){
%>
<%= i %>
<%
    }
%>

result on product.html

[object Object] [object Object]

How can i show all of each data in product.html (full_price, discount_price, quantity, prod_link, images, prod_desc)



via Moomoo Soso

No comments:

Post a Comment