Ik heb dus een stukje code geschreven. Maar ik wil de query in de while graag combineren met de query boven de while. Het wil mij maar niet lukken en ik weet überhaupt niet of het wel mogelijk is.
Kan iemand me helpen?
Kan iemand me helpen?
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| <? require_once("../include/include.inc.php"); $inhoud = $core->pad.'include/tpl/forum.tpl'; require_once($core->pad."include/header.inc.php"); $s_cats = mysql_query("Select cat.id, cat.titel As cat_titel From forum_cats As cat Order By volgorde") or die(mysql_error()); $core->sql_count++; while($f_cats = mysql_fetch_object($s_cats)) { $s_forums = mysql_query("Select f.titel, f.id, f.beschrijving, f.reacties, f.topics From forum_forums As f Where f.cat = '".$f_cats->id."' Group By f.id Order By volgorde") or die(mysql_error()); $core->sql_count++; // categorie $tpl->newBlock("tabel"); $tpl->newBlock("categorie_lijst"); $tpl->assign("tabel.titel", $f_cats->cat_titel); if(!mysql_num_rows($s_forums)) { // geen forums echo "NIKS!"; } else { // wel forums while($f_forums = mysql_fetch_object($s_forums)) { $tpl->newBlock("forum_lijst"); $tpl->assign(array("forum_titel" => $f_forums->titel , "topics" => $f_forums->aantal_topics, "reacties" => $f_forums->aantal_reacties , )); } } } require_once($core->pad."include/output.inc.php"); ?> |