我有一个根据周 ID 拆分信息的表格。这是创建它的查询:
$result = mysqli_query($con,"SELECT * FROM b_tasks_report WHERE TASK_ID=$taskid");
$current_week_id = -1;
while($row = mysqli_fetch_array($result))
{
if($current_week_id != $row['WEEK_ID'])
{
echo "<tr class='no-border'><td class='no-border'><div class='task-detail-title'>Week Number: " . $row['WEEK_ID'] . "</div></td></tr>";
echo "<tr>";
echo "<th width='100'>Day</th>";
echo "<th width='75'>Start</th>";
echo "<th width='75'>End</th>";
echo "<th width='100'>Billable Hours</th>";
echo "<th width='100'>Non Billable Hours</th>";
echo "</tr>";
$current_week_id = $row['WEEK_ID'];
}
echo "<tr>";
echo "<td class='tdclass'>" . $row['DAY'] . "</td>";
echo "<td class='tdclass'>" . $row['START'] . "</td>";
echo "<td class='tdclass'>" . $row['END'] . "</td>";
echo "<td class='tdclass'>" . $row['BILLABLE_HOURS'] . "</td>";
echo "<td class='tdclass'>" . $row['NON_BILLABLE_HOURS'] . "</td>";
echo "</tr>";
}
echo "</table>";
这有效,它放置了新的标题,用于标识每个新周 ID 的周数。但是我想要的是:我需要它们是单独的表,而不是具有多个分组周和上面的标题的表。
例如,假设我们有 3 周 ID 的 week_1、week_2 和 week_3。这几周我想要 3 张单独的桌子。我尝试了多种方法来做到这一点,但它一直在拆分行。
</table><table>
我知道它需要在 while 部分,只是不确定在哪里。
任何帮助表示赞赏