大家是不是这样取商品分类
程序员文章站
2022-05-06 20:03:47
...
PHP代码:--------------------------------------------------------------------------------
// 取商品分类
//**************************************************************************
$result=$db->query("SELECT * FROM categories WHERE categories_parent_id=0 ORDER BY categories_sort_order");
while($row=$db->fetch_array($result))
{
$categories.=$row[categories_name]."
";
$result2=$db->query("SELECT * FROM categories WHERE categories_parent_id=$row[categories_id] ORDER BY categories_sort_order");
while($row2=$db->fetch_array($result2))
{
$categories.=$row2[categories_name]."/";
}
$categories.="
";
}
//**************************************************************************
// 取商品分类
//**************************************************************************
$result=$db->query("SELECT * FROM categories WHERE categories_parent_id=0 ORDER BY categories_sort_order");
while($row=$db->fetch_array($result))
{
$categories.=$row[categories_name]."
";
$result2=$db->query("SELECT * FROM categories WHERE categories_parent_id=$row[categories_id] ORDER BY categories_sort_order");
while($row2=$db->fetch_array($result2))
{
$categories.=$row2[categories_name]."/";
}
$categories.="
";
}
//**************************************************************************
上一篇: 转帖:PHP4(windows版本)中的COM函数
下一篇: 前序遍历树实现无需递归的无限极分类