【发布时间】:2012-04-24 09:20:59
【问题描述】:
我创建了一个带有mysql 后端的php 页面,以显示包含员工姓名、月份、订单等的小表格的结果:
<table border="1" cellpadding="1" cellspacing="1">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Month</th>
<th scope="col">Cases</th>
</tr>
</thead>
<?php do { ?>
<tbody>
<tr>
<td><?php echo $row_rsChart2['ContactFullName']; ?></td>
<td><?php echo $row_rsChart2['Month']; ?></td>
<td><?php echo $row_rsChart2['Cases']; ?></td>
</tr>
</tbody>
<?php } while ($row_rsChart2 = mysql_fetch_assoc($rsChart2)); ?>
</table>
是否可以将月份列用作标题,在列标题中从左到右显示一月、二月、三月等,并将每个月的案例作为数据?
1 月 - 2 月 - 3 月 用户 1 100 47 89 用户 2 86 67 134默认布局显示为:
姓名 - 月份 - 案例 User1 100 年 1 月 用户 1 2 月 47 日 用户 2 1 月 67 日【问题讨论】:
-
我不确定我是否理解你想要的,但上面的代码有问题。您的循环应该创建
<tr>而不是<tbody>。只需将您的<?php do { ?>放入您的<tbody>。回到您的问题,如果您可以通过示例输出进行更多解释,那将有很大帮助。