【发布时间】:2017-05-14 15:36:24
【问题描述】:
我想制作一个动态记分板,将 MySQL 查询中的数据导入 html 表。这是我的查询:
query = db().fa('SELECT name, score '
'FROM `GIP-Schema`.scoreboard '
'INNER JOIN `GIP-Schema`.user ON user_id = user.id '
'ORDER BY score DESC')
顺便说一句,fa() 是一个 fetchall() 函数。如果有必要过滤掉 MySQL 表示法 ((item),(otheritem),),我可以使用正则表达式。
该表将使用一些引导类,我想它看起来像这样:
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Name</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{name1}}</td>
<td>{{score1}}</td>
</tr>
<tr>
<td>{{name2}}</td>
<td>{{score2}}</td>
</tr>
<tr>
<td>{{name3}}</td>
<td>{{score3}}</td>
</tr>
</tbody>
</table>
我需要做什么,将查询检索到的 MySQL 数据插入到表中。此外,表的行数应根据查询中的条目数增加。
【问题讨论】:
-
您能否更新您的帖子以提出明确的问题?
-
抱歉,忘了那一小部分,哈哈