Ingo Arndt: Ausgabe in PHP

Beitrag lesen

i wahsaga,

danke für deine Hilfe, leider bin nich so bewandert in php und ehrlich hier der Code:

1  $query = "select * from categories WHERE parent_id=1653 order by 2  cat_name asc";
3  $result = mysql_query($query);
4  if(!$result)
5  {  $TPL_categories_value .= $flr_001;} else
6  {  $num_cat = mysql_num_rows($result);
7  $i = 0;
8  while($i < $num_cat && $i < 25 / 2)

{ $cat_id = mysql_result($result,$i,"cat_id");
 $cat_name = mysql_result($result,$i,"cat_name");
 $sub_count = intval(mysql_result($result, $i, "sub_counter"));
 $cat_counter = (int)mysql_result($result, $i, "counter" );
 if ($sub_count!=0)
 $cat_counter = "(".$sub_count.")";
 else
 {$cat_counter = ""; }
 $cat_url = "./browse.php?id=$cat_id&SESSION_ID=$sessionIDU";
// Ausgabe für Kategorien
 $TPL_categories_value.= "<TR>
 <TD align="left"><img src=layout/spacer.gif width=10 height=30>
 <span class="punkt"><img src="layout/spacer.gif" width=10 height=10 border=0></span>
 <span class="text_tb_fett">$cat_name "." $cat_counter"."</span></TD></TR>";

// Anzeige Unterkategorien
 if ($SHOW_SUBCAT=="1")
 { $query_sub = "select * from categories WHERE parent_id=$cat_id order by cat_name asc";
 $result_sub = mysql_query($query_sub);
 if(!$result_sub)
 { $TPL_categories_value .= $flr_001;
 } else
 { $num_cat_sub = mysql_num_rows($result_sub);
 $j = 0;
 while($j < $num_cat_sub && $j < 20)
 {$cat_id_sub = mysql_result($result_sub,$j,"cat_id");
 $cat_name_sub = mysql_result($result_sub,$j,"cat_name");
 $sub_count_sub = intval(mysql_result($result_sub, $j, "sub_counter"));
 $cat_counter_sub = (int)mysql_result($result_sub, $j, "counter" );
 if ($sub_count_sub!=0)
 $cat_counter_sub = "(".$sub_count_sub.")";
 else
 { $cat_counter_sub = ""; }
 $cat_url_sub = "./browse.php?id=$cat_id_sub&SESSION_ID=$sessionIDU";

// Ausgabe für unterkategorien
 $TPL_categories_value .= "<TR><TD align="left"><img src=layout/spacer.gif width=30 height=10><A HREF="$cat_url_sub"><span class="alink">$cat_name_sub</span></A>"." $cat_counter_sub"."<img src=layout/spacer.gif width=1 height=8></TD></TR>";
 $j++;}}}
 $i++;}
 if ($num_cat >= 100)
 $TPL_categories_value .= "<A HREF="browse.php?id=0&SESSION_ID=$sessionIDU"><span class="text_error">$text_277...</span></A>";
 }
?>
 und da muß das noch rein aber an welche Stelle?
In Zeile 6-8 wird die Anzahl Ermittelt und in der 8 habe ich dann die
Anzahl durch 2 geteilt. Leider weiß ich jetzt nicht weiter.