categories and sub categories

From: Date: Mon, 06 Jun 2005 07:29:40 +0000
Subject: categories and sub categories
Groups: php.general 
Request: Send a blank email to php-general+get-216463@lists.php.net to get a copy of this message
Hi there, I am trying to retrieve cat and subcategories out of 2 db tables and output them via php. That seems not to be that trivial. My goal is to have output like this: - Languages : php : asp - Fruites : apples : peaches Therefore I do have a table cat and a tabel sub_cat and the values are filled into the arrays $cat[main][name] and $cat[sub][name]. Now here is my output try: for ($i=0;$i<count($cat[main][name]);$i++){ # output main cat echo $cat[main][name][$i]; # output subcats which belong to this main cat for ($k=0;$k<count($cat[sub][name]);$k++){ cat[sub][name][$k]; } }; I am lost here and could need some advice. Any help is appreciated. Merlin

« previous php.general (#216463) next »