\n"; while ($data = @mysql_fetch_array($result)) { $category_id = $data["id"]; $category = $data["category"]; echo "

$category

\n"; $sects = mysql_query("SELECT section from section where category_id = $category_id"); while ($data = mysql_fetch_array($sects)) { $section = $data["section"]; echo "•  $section
\n"; } } echo "
\n"; } function show_articles($this_category,$this_section) { global $dbhost, $dbname, $dbuser, $dbpass; connect_db(); // select either all articles, all in a category or all in a section if (($this_category == "") && ($this_section == "")) { $result = mysql_query("SELECT id, section FROM section"); } else if ($this_section == "") { $result = mysql_query("SELECT sctn.id, sctn.section FROM section sctn, category ctgy WHERE sctn.category_id = ctgy.id and ctgy.category = '$this_category'"); } else { $result = mysql_query("SELECT id, section FROM section WHERE section = '$this_section'"); } while ($data = @mysql_fetch_array($result)) { $section = $data["section"]; $sect_id = $data["id"]; $sects = mysql_query("SELECT arti.id FROM article arti, article_section asec WHERE arti.id = asec.article_id and asec.section_id = $sect_id"); $no_sects = 0; while ($no = mysql_fetch_row($sects)) { $no_sects++; } if ($no_sects>0){ echo "
\n"; echo "

$section

\n"; $pages = mysql_query("SELECT arti.id, arti.article, arti.label FROM article arti, article_section asec WHERE arti.id = asec.article_id and asec.section_id = $sect_id order by arti.seq_id"); while ($data = mysql_fetch_array($pages)) { $article = $data["article"]; $label = $data["label"]; if (!$page){ echo "•  $article
\n"; } } echo "

\n"; } } } ?>