我有以下 php 代码:
echo "<div style='float:left;'>";
echo "<table>";
echo "<tr>";
echo "<th></th>";
echo "<th colspan='4'>Laks beholdt</th>";
echo "</tr>";
echo "<tr>";
echo "<th>Uke</th>";
echo "<th><3 kg</th>";
echo "<th>3-7 kg</th>";
echo "<th>>7 kg</th>";
echo "<th>Totalt</th>";
echo "</tr>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC) or die(mysql_error()))
{
echo "<tr>";
echo "<td>" . $row['Uke'] . "</td>";
echo "<td style='text-align:right; padding-right:10px;'>" . number_format($row['SumSmall'], 1,
",", " ") . " kg</td>";
echo "<td style='text-align:right; padding-right:10px;'>" . number_format($row['SumMedium'], 1,
",", " ") . " kg</td>";
echo "<td style='text-align:right; padding-right:10px;'>" . number_format($row['SumLarge'], 1,
",", " ") . " kg</td>";
echo "<td style='text-align:right; padding-right:10px;'>" . number_format($row['SumVekt'], 1, ",",
" ") . " kg</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
我从 while 循环中获得了预期的输出,但我的表和 div 的结束标签 - 或任何其他输出 - 没有显示。我没有收到任何错误消息,也没有在我的 html 中看到任何错误。我尝试通过数字而不是关联来引用数组,但我得到了相同的结果。
我已经写了一百个类似的循环没有错误,但我在这里没有想法:/