我有这个代码,我想防止表头重复。有人可以帮忙吗?该网站要求我提供更多详细信息,然后才能发布此问题。
if (isset($_POST['toys'])) {
$query = 'SELECT * FROM `toys` WHERE size = ?';
$sth = $db->prepare($query);
foreach($_POST['toys'] as $each_check) {
if( ! $sth->execute(array($each_check)) ) {
die('MySQL Error: ' . var_export($sth->error_info(), TRUE));
}
echo "<table>";
echo "<tr>
<th>ratio</th>
<th>size</th>
<th>built</th>
<th>description</th>
</tr>";
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
echo "<tr><td>" . $row['ratio'] .
"</td><td>" . $row['size'] .
"</td><td>" . $row['built'] .
"</td><td>" . $row['description'] .
"</td></tr>";
}
echo "</table>";
}
}
坦克