我正在从数据库中打印出一张包含 27 列的表格,因此很明显,如果在我的屏幕上可以看到 27 列,这将在美学上令人不快。所以这是我一直用来查看特定 col 是否为空的条件之一,如果它为空,则不会打印表头,如果没有打印另一个 if isset 条件将不会打印表数据。但它并没有按计划进行。这些是我尝试过的变体,但它们都不起作用 PS $result = 查询返回的行数。
$i = 1;
while ($i <= $result)
{
if (!empty($array['Others'][$i]))
{
$others = print "<th>Others</th>";
break;
}
$i++;
}
$i = 0;
while ($i <= $result)
{
$emptyothers = !empty($array['Others'][$i]);
if ($emptyothers == '1')
{
$others= print "<th>Others</th>";
break;
}
$i++;
}