【发布时间】:2014-04-09 23:21:37
【问题描述】:
嗨,我完全坚持这个。 我正在对从 mysql 数据库中提取的数据使用 tablesorter。 问题是,根据标准,我可以拉出并显示多个表格。
我的问题是 tablesorter 只会对第一个表实例进行排序。
这是我用于表格排序器的代码。基本使用。
<script type="text/javascript" >
$(document).ready(function()
{
$("#table-2").tablesorter();
}
这就是我提取数据并将其与 tablesorter 一起使用的方式。 可以更改的是分支名称。如果为用户分配了多个分支,他们将获得多个表。这就是我坚持在第一个实例之后的任何表上实现 tablesorter 的地方。
$result=mysql_query("SELECT id FROM users WHERE username='$username'");
$idary=mysql_fetch_assoc($result);
$id=$idary['id'];
$result0=mysql_query("SELECT branch_id FROM access WHERE userid='$id'");
while ($row1=mysql_fetch_assoc($result0))
{
$branch_id=$row1['branch_id'];
$result=mysql_query("select distinct(name) from location where id='$branch_id'");
$nameary=mysql_fetch_assoc($result);
$branchname=$nameary['name'];
?>
<table>
<thead>
<b><br><?echo $branchname; ?></b>
</thead>
</table>
<div>
<table id='table-2' class='tablesorter'>
<thead>
<tr>
<thCreator</th>
<th><center>TeamName</th>
<th><center>Tech Tot</th>
<th><center>Tot W/O</th>
<th><center>Tot S/C</th>
</tr>
</thead>
// get team creators from province
$result1=mysql_query("select distinct(teamcreator) from techteams where....
我想我需要使用某种形式的递增表名来匹配拉取的表数,但我一直不知道如何做到这一点。 我的假设可能是错误的,并且可能有更简单的方法来做到这一点。
如果有人对正确的方向有任何指示,我会喜欢一些提示。
干杯, -科林。
【问题讨论】:
标签: javascript php jquery mysql tablesorter