Here is what I\'m trying to do: - i need a function that when passed as an argument an ID (for a category of things) will provide all the subcategories and the sub-sub categ
function categoryChild($id)
{
$s = "SELECT category_id,name FROM proads_categories WHERE parent_id =".$id;
$r = mysql_query($s);
$children = array();
if(mysql_num_rows($r) > 0)
{
#It has children, let's get them.
while($row = mysql_fetch_array($r))
{
#Add the child to the list of children, and get its subchildren
$children[$row['category_id']]['nam'] = $row['name'];
$arr = categoryChild($row['category_id']);
if(count($arr) > 0)
{
$children[$row['category_id']]['child'] = categoryChild($row['category_id']);
}
}
}
return $children;
}
It's perfect. If you need please try this