Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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)

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

[object Object] is the default toString result. What you can do is use JSON.stringify() or explicitly state what you want to display, like i.quantity, i.image etc.

<table>
<% for(var i=0; i < related.length; i++) { %>
   <tr>
     <td><%= related[i].full_price %></td>
     <td><%= related[i].discount_price%></td>
   </tr>
<% } %>
</table>
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!