function get_trove_sub_projects($cat_id) { if (!$cat_id) { return ''; } echo '<P>IN SUBPROJECT' . $cat_id; //return an array of trove categories under $cat_id $sql = "SELECT trove_cat_id FROM trove_cat WHERE parent IN ({$cat_id})"; $result = db_query($sql); echo db_error(); $rows = db_numrows($result); for ($i = 0; $i < $rows; $i++) { $trove_list = array_merge(get_trove_sub_projects(db_result($result, $i, 0)), $trove_list); } return array_merge(util_result_column_to_array($result), $trove_list); }
function get_trove_sub_projects($cat_id) { global $cat_counts, $sum_totals, $parent_list; //number of groups that were in this trove_cat $count = $cat_counts[$cat_id][1]; if ($count == '') { $count = 0; } //number of children of this trove_cat $rows = count(@$parent_list[$cat_id]); for ($i = 0; $i < $rows; $i++) { $count += get_trove_sub_projects($parent_list[$cat_id][$i]); } $sum_totals["{$cat_id}"] = $count; return $count; }