萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> 大家是不是這樣取商品分類

大家是不是這樣取商品分類

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]."<BR>";
$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.="<BR><BR>";
}
//**************************************************************************
copyright © 萬盛學電腦網 all rights reserved