Hello, I'm working on a recursive loop subcategory system. The code below is ALMOST where I need it. The last thing I'd like to do is indent each subcategory based on levels deep, rather than just separate by commas. I can't seem to wrap my head around it. Any suggestions?
function showlist($parent, &$catlistids="") {
$result = mysql_query("SELECT component_part_id, component_part_quantity_used FROM builds WHERE build_part_id='$parent'");
while ($line = mysql_fetch_array($result)) {
if($catlistids!=""){ $catlistids .= ", "; }
$catlistids .= get_part($line["component_part_id"]) . ' ' . $line["component_part_quantity_used"];
showlist($line["component_part_id"], &$catlistids);
}
return $catlistids;
}