HTML interesse |
|
IK heb zon forumpje geprogrammeerd met php, alleen waar, en hoe kan je catogorieen toevoegen?
Dit is categorie script:
<?php
include("config.php");
?>
<HTML>
<HEAD>
<TITLE><?php echo $forumname; ?> - categorieën</TITLE>
<LINK HREF="style.css" TYPE="text/css" REL="stylesheet">
</HEAD>
<BODY>
<B><?php echo $forumname; ?></B><BR>
<BR>
<TABLE WIDTH="500" BORDER="1" CELLSPACING="0" CELLPADDING="2">
<?php
$query = mysql_query("SELECT * FROM categories ORDER BY id ASC") or die(mysql_error());
if(mysql_num_rows($query)) {
while($row = mysql_fetch_row($query)) {
$cat = $row[0];
echo "<TR><TD WIDTH=\"500\">\n";
// topic name
echo "<A HREF=\"forum.php?cat=".$cat."\">".$row[1]."</A> ";
// number of topics
$topics = mysql_query("SELECT COUNT(*) FROM forum WHERE cat=$cat") or die(mysql_error());
echo "(".mysql_result($topics, 0).")<BR>\n";
mysql_free_result($topics);
// description of each topic
echo $row[2]."<BR>\n";
echo "</TD></TR>\n";
}
mysql_free_result($query);
} else {
echo "<TR><TD WIDTH=\"500\">\n";
echo "Er zijn nog geen categorieën.<BR>\n";
echo "</TD></TR>\n";
}
?>
</TABLE>
</BODY>
</HTML>
|