OK, here is the script with a little commenting:
function recurse_path($cat_id=0, $path="")
{
$result = safe_query("SELECT * FROM web_cat WHERE web_cat_id='$cat_id'");
$row = mysql_fetch_assoc($result);
echo("$row[web_cat_parent],$row[web_cat_title]<hr>"); // this line is just to test whether it is recurring
$path = " " . $row[web_cat_title] . " / " . $path. " " ; //supposedly this will load the path
if( $row[web_cat_parent] != 0 )
{
recurse_path($row[web_cat_parent], $path);
}
return $path;
}
echo("<hr>" . recurse_path(10) . "<hr>");
This get's the path (parent/child relationship) of the given category (in this case, 10). The data it retrieves looks like this:
id/parent/title
1/0/downloads
2/1/software
10/2/sexy software
When the script is run, it echo's:
2, sexy software
1, software
0, downloads
However, where it should print the total path, it only prints "sexy software".
what am I missing?