1 回答
TA贡献1851条经验 获得超3个赞
您所要做的就是将表头移出 foreach 循环:
if (count($resultssample) > 0) {
echo "<br>";
echo "Number in the business: ".count($resultssample)."<br>";
echo "<br>";
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th>site name</th>";
echo "<th>location name</th>";
echo "<th>creation time</th>";
echo "<th>creation date</th>";
echo "<th>damage status</th>";
echo "<th>colour</th>";
echo "<th>inventory status</th>";
echo "<th>notes</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
foreach ($resultssample as $r) {
echo "<tr>";
echo "<td>". $r['site_name'] ."</td>";
echo "<td>". $r['location_name'] ."</td>";
echo "<td>". $r['CreationTime'] ."</td>";
echo "<td>". $r['CreationDate'] ."</td>";
echo "<td>" . $r['damage_status'] . "</td>";
echo "<td>" . $r['colour'] . "</td>";
echo "<td>" . $r['inventory_status'] . "</td>";
echo "<td>" . $r['Notes'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
} else {
echo "No results found";
}
- 1 回答
- 0 关注
- 54 浏览
添加回答
举报