Forum geeft categorien niet weer
Ik heb zelf een forum geprobeerd te maken.
Nu heb ik dit; het hoort de categorien met de bijbehordende forums weer te geven:
categorie 1
forum in categorie 1
forum in categorie 1
forum in categorie 1
categorie 2
forum in categorie 2
enzovoort.
Maar alleen de forums in categorie 1 worden weergegeven. Ik dacht dus dat de fout ergens in mijn while zat, maar kan hem niet vinden.
Weet een van jullie waar de fout zit?
Bij voorbaat dank,
Lennard.
Hier mijn script (sorry dat ie een beetje lang is):
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
include("include/header.php");
$sql = "SELECT * FROM forum_cats ORDER BY volgorde ASC";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
while($cats = @mysql_fetch_assoc($sql)) {
?>
include("include/header.php");
$sql = "SELECT * FROM forum_cats ORDER BY volgorde ASC";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
while($cats = @mysql_fetch_assoc($sql)) {
?>
<table cellpadding="0" cellspacing="5" width="100%">
<tbody>
<tr>
<td width="100%">
<table style="border: 1px solid rgb(255, 255, 255);" bgcolor="#d6d7d7" cellpadding="4" cellspacing="0" width="100%">
<tbody>
<tr>
<td style="border: 1px solid rgb(192, 192, 192);" width="100%">
<table style="border: 1px solid rgb(192, 192, 192);" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="100%">
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td style="border: 1px solid rgb(44, 88, 111);" bgcolor="#ffffff" width="100%">
<table cellpadding="0" cellspacing="1" width="100%">
<tbody>
<tr>
<td class="content" background="images/content_bg.gif" bgcolor="#366c88" height="25" width="100%">
<font color="#ffffff"><b><a name="">- </a></b></font>
</td>
</tr>
</tbody>
</table>
Code (php)
1
2
3
4
5
2
3
4
5
<?php
$forums = "SELECT * FROM forum_forums WHERE forum_cat = '".$cats['id']."'";
$forums = @mysql_query($forums) or die(mysql_error().'<br>'.$forums);
while($for = @mysql_fetch_assoc($forums)) {
?>
$forums = "SELECT * FROM forum_forums WHERE forum_cat = '".$cats['id']."'";
$forums = @mysql_query($forums) or die(mysql_error().'<br>'.$forums);
while($for = @mysql_fetch_assoc($forums)) {
?>
<table cellpadding="0" cellspacing="8" width="100%">
<tbody>
<tr>
<td style="border: 1px solid rgb(192, 192, 192);" width="100%">
<table cellpadding="2" cellspacing="0" width="100%">
<tbody>
<tr>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(192, 192, 192);" width="5%">
</td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(192, 192, 192);" bgcolor="#f8f7f7" width="46%"><b>Forum & Beschrijving:</b>
</td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(192, 192, 192);" width="10%"><div align="center"><b>Topics: </b></div>
</td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(192, 192, 192);" bgcolor="#f8f7f7" width="11%"><div align="center"><b>Reacties: </b></div>
</td>
<td style="border-bottom: 1px solid rgb(192, 192, 192);" width="30%"><div align="center"><b>Laatste Post: </b></div>
</td>
</tr>
<tr>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(240, 240, 240);" width="5%"><div align="center"><img src="images/actief.gif" alt="In dit Forum is in de laatste 24 uur géén activiteit getoond."></div>
</td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(240, 240, 240);" bgcolor="#f8f7f7" width="46%">
<table cellpadding="1" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="100%"><span style="float: right;"><img src="images/nieuw.gif" alt="Open een nieuw topic in dit forum." border="0"></span><b>› </b><br></td>
</tr>
</tbody>
</table>
</td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(240, 240, 240);" width="10%"><div align="center">
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
$sql = "SELECT * FROM forum_topics WHERE forum_id = '".$for['id']."'";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_num_rows($sql);
echo $sql;
?>
$sql = "SELECT * FROM forum_topics WHERE forum_id = '".$for['id']."'";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_num_rows($sql);
echo $sql;
?>
</div></td>
<td style="border-right: 1px solid rgb(240, 240, 240); border-bottom: 1px solid rgb(240, 240, 240);" bgcolor="#f8f7f7" width="11%"><div align="center">
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
$sql = "SELECT * FROM forum_reacties WHERE forum_id = '".$for['id']."'";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_num_rows($sql);
echo $sql;
?>
$sql = "SELECT * FROM forum_reacties WHERE forum_id = '".$for['id']."'";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_num_rows($sql);
echo $sql;
?>
</div></td>
<td style="border-bottom: 1px solid rgb(240, 240, 240);" width="30%"><div align="center">Door
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
$sql = "SELECT * FROM forum_reacties WHERE forum_id = '".$for['id']."' ORDER BY datum DESC LIMIT 0,1";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_fetch_assoc($sql);
echo getusername($sql['auteur']).'<br><sub>Op '.date('d-m-Y H:i', $sql['datum']);
?>
$sql = "SELECT * FROM forum_reacties WHERE forum_id = '".$for['id']."' ORDER BY datum DESC LIMIT 0,1";
$sql = @mysql_query($sql) or die(mysql_error().'<br>'.$sql);
$sql = @mysql_fetch_assoc($sql);
echo getusername($sql['auteur']).'<br><sub>Op '.date('d-m-Y H:i', $sql['datum']);
?>
<img src="images/laatste.gif" border="0"></sub></div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<font size="1"> </font>
De mysql_error() geeft ook geen foutmelding...
Er zijn nog geen reacties op dit bericht.