nate@xxxxxxxxxxxxxxxx wrote:
function recursePathLookup($CatID, $Path = array()) {
//Get the catid for this subcat
$sql = "SELECT SubCategoryID, Name FROM categories WHERE CategoryID =
'".$CatID."'";
$query = mysql_query($sql);
if(mysql_num_rows($query) == 1) {
$data = mysql_fetch_array($query);
$Path[] = $data["Name"];
recursePathLookup($data["SubCategoryID"], $Path);
change to:
return recursePathLookup($data["SubCategoryID"], $Path);
} else {
//print_r($Path);
return $Path;
}
}
print_r(recursePathLookup(2));
Any ideas why when I uncomment the //print_r($Path) inside the function it
prints the value fine, but when I try to return the value and print it
outside the function I get nothing?
Thanks,
Nate
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php