/ Published in: PHP
your database needs id, bezeichner and parent fields
Expand |
Embed | Plain Text
<?php function xmlloop($intParent=0, $intEbene=0){ $space = null; for ($i=0;$i<$intEbene;$i++) $space .= ' '; $child = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as anzahl FROM xmltest WHERE parent = ".$query["id"]." GROUP BY id")); if($child["anzahl"]>0){ xmlloop($query["id"], ($intEbene+1)); } } } xmlloop(); ?>
You need to login to post a comment.
