|  | Posted by frizzle on 06/18/54 11:36 
Lüpher Cypher schreef:
 > frizzle wrote:
 > > Maybe i'm wrong, but you're saying you're using two queries,
 > > but if i get this right, you're running a query for each category,
 > > or am i wrong?
 >
 > Well, the first query retrieves categories. They are then output from
 > while loop and inside the second second query retrieves forums and
 > thread count :) I meant that there are two query strings, there's going
 > to be #cats+1 query executions :)
 >
 >
 >
 > --
 >
 > - lüpher
 > ---------------------------------------------
 > "Man sieht nur das, was man weiß" (Goethe)
 
 Ok, then i understood what you meant.
 I sort of made a combination of one query, what i wanted at first, and
 your solution;
 I run a query to get the categories, and one to get the forums and
 their 'belongings'. (So two in total, no matter how many categories
 there are ... )
 
 I put results of both queries in an array.
 Array 1 is the one of categories:
 $cat_array[ $cats['cat_id'] ] = array(
 'cat_id'         =>  $cats['cat_id'],
 'cat_descr'   =>  $cats['cat_descr']
 );
 
 Array 2 (forums):
 $forum_array[ $forums['forum_id'] ] = array(
 'forum_id'                    =>  $forums['forum_id'],
 'forum_cat_id'             =>  $forums['forum_cat_id'],
 'forum_title'                 =>  $forums['forum_title'],
 'forum_descr'              =>  $forums['forum_descr'],
 'number_of_threads'    =>  $forums['number_of_threads']
 );
 
 What i wonder now, if i run a foreach with the cat_array
 How can i get the items from the forum_array that correspond to the
 current cat_array
 ( so where $forum_array['forum_cat_id'] = $cat_array[ current id ] )
 So now we've moved from a mysql to PHP question. :)
 
 Frizzle.
  Navigation: [Reply to this message] |