function get_dtypelist($dtype_id,$fun_count){
$result=mysql_query("SELECT * FROM category where dtype_up ='$dtype_id'");
while ($row=mysql_fetch_array($result))
{
echo "<option value='".$row['dtype_id']."'>";
for($j=0;$j<$fun_count;$j++){
echo " ";
}
echo "|→".$row['dtype_name']."</option>";
if(get_dtypecount($row['dtype_id'])>0)
{
$fu_count=$fun_count+1;
get_dtypelist($row['dtype_id'],$fu_count);
}
}
}参考一下
$result=mysql_query("SELECT * FROM category where dtype_up ='$dtype_id'");
while ($row=mysql_fetch_array($result))
{
echo "<option value='".$row['dtype_id']."'>";
for($j=0;$j<$fun_count;$j++){
echo " ";
}
echo "|→".$row['dtype_name']."</option>";
if(get_dtypecount($row['dtype_id'])>0)
{
$fu_count=$fun_count+1;
get_dtypelist($row['dtype_id'],$fu_count);
}
}
}参考一下
$query_count=mysql_query("SELECT count(type_id) as c_total FROM category where type_up='$type_id'");
$arr_count=mysql_fetch_array($query_count);
$total=$arr_count[c_total];
return $total;
}
$query_dcount=mysql_query("SELECT count(dtype_id) as dc_total FROM category where dtype_up='$dtype_id'");
$arr_dcount=mysql_fetch_array($query_dcount);
$dtotal=$arr_dcount[dc_total];
return $dtotal;
}