Global Moderator
Internet Junkie
Gender:
Posts: 1525
6359 credits Members referred : 8
Gimme all your cookies!!!
« on: May 05, 2006, 11:03:09 am »
Hi Guys,
It has been a long day and I think that I have been staring at this 24" LCD too long
Have a look at this code and see if you can see anything wrong with it and if you can improve... I am trying to get the function to return an array of category ID's, but have ended up trying to get it to work using a string; but even that is not working! Grrr...
Code:
<?php function getDirCrumbIDs($catID, $str = null) { global $db;
$sql = "select * from category where categoryid = '$catID' limit 1";
if ($row = $db->get_row($sql)) { getDirCrumbIDs($row->CategoryParentID, "$catID|".$str); }
return $str; }
echo getDirCrumbIDs($_GET['cat']);
?>
Trying to just echo the returned string, but it is outputting nothing. If I echo the $str in the function as it runs through all the categories, it definitely prints the correct values. The last echo is just not outputting anything.