How to change the data that is output to the function

Hello !
I have the following array for handling the categories and subcategories that have been created. The only way I can get out is a symbol in front of the categories.
How can I edit the code to output the main category and, for example, in the unorder list its subcategories?

	function fetchCategoryTree($parent = 0, $spacing = '', $user_tree_array = '') {
	
		if (!is_array($user_tree_array))
			$user_tree_array = array();
	
			$sql = "SELECT * FROM `products_category_translate` WHERE `parentID` = $parent AND `language` = '".lang()."'";
			$query = mysql_query($sql);
		
		    if (mysql_num_rows($query) > 0) {
				while ($row = mysql_fetch_object($query)) {
				$user_tree_array[] = array("id" => $row->id, "uniqueID" => $row->uniqueID, "title" => $spacing . $row->title);
				$user_tree_array = fetchCategoryTree($row->uniqueID, $spacing . '-- ', $user_tree_array);
			}
		}
		return $user_tree_array;
	}

	<?php 
		$categoryList = fetchCategoryTree();
		foreach($categoryList as $cl) { 
			echo '<a href="'.$g['url'].''.languageURL('0', 'products/'.$cl['uniqueID'].'/'.convertToURL($cl['title']).'.html').'">'.$cl['title'].'</a><br>';
		
		} 
		
	?>
  `id` int(11) NOT NULL,
  `uniqueID` int(11) NOT NULL,
  `language` varchar(2) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `parentID` int(11) NOT NULL,
  `views` int(11) NOT NULL

looks like fetchCategoryTree already gives you the hierarchy, so whats the problem to put this in an unordered list? Just have a look at var_dump($categoryList).

Sponsor our Newsletter | Privacy Policy | Terms of Service