【发布时间】:2021-01-15 04:51:06
【问题描述】:
我从 mysql db 中获取了结果,并且在我的控制台中获取了数据,但它不会在我的 ejs 页面中呈现。 这是我的 .ejs 页面代码:
<table>
<tr>
<th>Name</th>
<th>Date Formed</th>
<th>Location</th>
</tr>
<%for(int i = 0;i < Allo.length; i++){%>
<tr>
<td><%=Allo.name%></td>
<td><%=Allo.form_date%></td>
<td><%=Allo.location%></td>
</tr>
<%}%>
</table>
这是我的 app.js:
app.get("/Teams",function(req,res){
db.query('SELECT * FROM team',function(err,result){
console.log(result);
res.render("Teams",{Foo:"",Allo:result});
});
});
console.log(result) 工作正常。
【问题讨论】:
标签: html mysql node.js express ejs