Ignore:
Timestamp:
Jul 1, 2003, 11:27:20 AM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r19 r21  
    1515 *                                                                         *
    1616 ***************************************************************************/
     17
    1718function get_subcats_id( $cat_id )
    1819{
    19   $restricted_cat = array();
    20   $i = 0;
     20  $restricted_cats = array();
    2121               
    22   $query = 'select id';
    23   $query.= ' from '.PREFIX_TABLE.'categories';
    24   $query.= ' where id_uppercat = '.$cat_id;
     22  $query = 'SELECT id';
     23  $query.= ' FROM '.PREFIX_TABLE.'categories';
     24  $query.= ' WHERE id_uppercat = '.$cat_id;
    2525  $query.= ';';
    2626  $result = mysql_query( $query );
    2727  while ( $row = mysql_fetch_array( $result ) )
    2828  {
    29     $restricted_cat[$i++] = $row['id'];
    30     $sub_restricted_cat = get_subcats_id( $row['id'] );
    31     for ( $j = 0; $j < sizeof( $sub_restricted_cat ); $j++ )
    32     {
    33       $restricted_cat[$i++] = $sub_restricted_cat[$j];
    34     }
    35   }
    36                
    37   return $restricted_cat;
     29    array_push( $restricted_cats, $row['id'] );
     30    $sub_restricted_cats = get_subcats_id( $row['id'] );
     31    foreach ( $sub_restricted_cats as $sub_restricted_cat ) {
     32      array_push( $restricted_cats, $sub_restricted_cat );
     33    }
     34  }
     35  return $restricted_cats;
    3836}
    3937
Note: See TracChangeset for help on using the changeset viewer.