I'm under a deadline, and for whatever reason, can't figure out why this snippet of code isn't working. I'm trying to build a site map function, (parent,child relationship based on id).
It almost works, but I can't get the indent feature to work correctly. Any thoughts? here's the code: $connect=mysql_connect($bshostname,$bsusername,$bspassword); $thedb=mysql_select_db($bsdatabase); $thequery="select * from items where type='main'"; $theresults=mysql_query($thequery) or die(mysql_error()); function outputTree($parentid,$level) { $query="select id,name from items where whichpage='$parentid'"; $treeresults=mysql_query($query) or die (mysql_error()); while ($treebranch=mysql_fetch_assoc($treeresults)) { for ($i = 0; $i < $level; $i++) { echo " "; } echo "$treebranch[name]<br>"; outputTree($treebranch["id"],$level++); } //end function } while ($output=mysql_fetch_assoc($theresults)) { echo $output["name"]."<br>"; outputTree($output["id"],1); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php