我有一个到数据库的 PDO 连接,该连接返回所搜索的项目编号的任何结果。它当前在自己的表中返回每个实例,但我希望在一个表中查看所有实例。这是我的代码。
if (count($resultssample) > 0) {
echo "<br>";
echo "Number in the business: ".count($resultssample)."<br>";
echo "<br>";
foreach ($resultssample as $r) {
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>";
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";
}
如何才能实现这一点,我目前无法解决这个问题。
任何帮助将不胜感激。
皈依舞