Hello,
I'm using the following function:
>>BEGIN CODE<<
$q_cat ="SELECT cat_id, cat_naam, cat_parent_id FROM cat";
$r_cat = mysql_query($q_cat) or die ("Invalid Query fout Q=cat");
if ($r_cat)
$n=0;
if (mysql_num_rows($r_cat) > 0)
while ($row_cat = mysql_fetch_array($r_cat))
$item[$row_cat[cat_id]][naam] = $row_cat[cat_naam];
$item[$row_cat[cat_id]][id] = $row_cat[cat_id];
$kidsof[$row_cat[cat_parent_id]][] = $row_cat[cat_id];
}
}
}
#CAT-FUNCTIE
function print_tree($id=0,$spatie=0,$sid)
global $kidsof;
global $item;
global $sid;
$j=0;
while ($j < $spatie)
echo " ";
$j++;
}
$i=0;
$spatie++;
print ("<a href='show_cat.php?sid=".$sid."&cat_id=".$item[$id][id]."'
target=\"inhoud\">".$item[$id][naam]."</a><br>\n");
while ($i < count($kidsof[$id]))
print_tree($kidsof[$id][$i],$spatie,$sid);
$i++;
}
}
print_tree();
>>END CODE<<
It prints the tree of categories with all childs under the parent categories
with there parents.
But when I call the function with $id=5 (I want the categorie-tree of cat 5
and children) nothing happens.
How can I change the function so the cat-tree for $id=$var1 will be shown??
Kind regards,
Bart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]