gpt4 book ai didi

PHP/HTML 表无法正常运行

转载 作者:行者123 更新时间:2023-11-30 00:49:51 27 4
gpt4 key购买 nike

我在使 PHP 文件正常运行时遇到问题。它应该显示一个两列表,其中包含部门(无序列表)和部门类别(每个部门下的有序列表)。

目前的结果是第二列显示得非常好,每个项目符号部门下方都有项目符号无序列表和编号有序列表。但是,显示的第一列没有任何项目符号或数字。数据在那里,但不是我期望的格式(ul 和 ol)。

谢谢你的帮助。如果您需要更多信息,请与我们联系。

<?php
//displayDepartments.php
$query = "SELECT * FROM product_categories_reference
ORDER BY department_name DESC";
$category = mysql_query($query)
or die(mysql_error());
$numRecords = mysql_num_rows($category);
$catCount = 0;
$currentDepartment = "";
echo "<table><tr><td><ul>";
for ($i = 0; $i < $numRecords; $i++)
{
$row = mysql_fetch_array($category);
if ($currentDepartment != $row["department_name"])
{
if ($currentDepartment != "") echo "</ol></li>";
if ($catCount > $numRecords/2)
{
echo "</ul></td><td valign='top'><ul>";
$catCount = 0;
}
$currentDepartment = $row["department_name"];
echo "<li>$currentDepartment<ol>";
}
echo "<li><a href=\"category.php?cat='"
.$row["product_category_code"] . "'\">"
.$row["product_category_description"]
."</a></li>";
$catCount++;
}
echo "</ol></li></ul></td></tr></table>";
?>

最佳答案

您尚未提供 css 或链接,因此这是猜测。

我假设您的 css 的 list-style-type 设置为 none。

更改为

ul {
list-style-type: disc;
}

关于PHP/HTML 表无法正常运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21071792/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com