我有要使用 express-handlebars 显示的 sql 查询结果
var x={} ;
//friends表得到了name|profileName|status属性
dao.findFriends(req.session.UserName,function(err,rows,fields){
x=rows;
for(var i=0;i<rows.length;i++){
console.log(rows[i].profileName);
}
});
res.render('home',{body:'hello ...'+req.session.UserName,friends:x});
简单的字符串显示正常,但不是 sql 结果
<table>
<tr>
<th>Name</th>
</tr>
{{#each friends}}
<tr>
<td>{{profileName}}</td>
</tr>
{{/each}}
</table>