Onbekend |
|
Helloow ik ben bezig aan een nieuw forum waar de subcat en gw cat in 1 tabel staan(mysql) Maar mijn script werkt niet 100% er word niks in mijn variabelen gestoken ziet iemand wat er fout is hieronder zie je de code!
<table width="95%" cellspacing="0" cellpadding="0" style="border: 1px solid #CCCCCC">
<?php
include('config.php');
$res2 = mysql_query("SELECT * FROM categories WHERE cat='1'") or die(mysql_error());
if (mysql_num_rows($res2)) {
while ($row = mysql_fetch_row($res2)) {
$subcat = $row[id];
$catnaam = $row[naam];
?>
<tr>
<td width="76%" bgcolor="#CCCCCC"><? echo "nennaam"; ?></td>
<td width="12%" bgcolor="#CCCCCC">Topics</td>
<td width="12%" bgcolor="#CCCCCC">Replys</td>
</tr>
<?
$res1 = mysql_query("SELECT * FROM categories WHERE subcat='$subcat'") or die(mysql_error());
if (mysql_num_rows($res1)) {
while ($row1 = mysql_fetch_row($res1)) {
$cat = $row1[id];
$naam = $row1[naam];
$beschrijving = $row1[descr];
$query3 = mysql_query("SELECT COUNT(*) FROM forum WHERE cat='$cat'") or die(mysql_error());
$topics = mysql_result($query3, 0);
$query4 = mysql_query("SELECT COUNT(*) FROM forumreplys WHERE titel='$cat'") or die(mysql_error());
$replys = mysql_result($query4, 0);
?>
<tr>
<td><? echo "<A HREF=\"index.php?pagina=forum1&cat=".$cat."\"><b>$naam</b></a><br>$beschrijving"; ?></td>
<td><? echo "$topics"; ?></td>
<td><? echo "$replys"; ?>;</td>
</tr>
<?
} mysql_free_result($res1);
} else { echo "<tr><td colspan=\"3\" align=\"center\"><font color=\"#FF0000\">Er zijn nog geen subcategorien!</font></td></tr>"; }
} mysql_free_result($res2);
} else { echo "<font color=\"#FF0000\">Er zijn nog geen categorien!</font>"; }
?>
<tr>
<td align="center" colspan="3"> </td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" style="border: 1px solid #CCCCCC"> <?php include('config.php'); $subcat = $row[id]; $catnaam = $row[naam]; ?> <tr> <td width="76%" bgcolor="#CCCCCC"> <? echo "nennaam"; ?></td> <td width="12%" bgcolor="#CCCCCC">Topics</td> <td width="12%" bgcolor="#CCCCCC">Replys</td> </tr> <? $cat = $row1[id]; $naam = $row1[naam]; $beschrijving = $row1[descr]; ?> <tr> <td> <? echo "<A HREF=\"index.php?pagina=forum1&cat=".$cat."\"><b>$naam</b></a><br>$beschrijving"; ?></td> <td> <? echo "$topics"; ?></td> <td> <? echo "$replys"; ?>;</td> </tr> <? } else { echo "<tr><td colspan=\"3\" align=\"center\"><font color=\"#FF0000\">Er zijn nog geen subcategorien!</font></td></tr>"; } } else { echo "<font color=\"#FF0000\">Er zijn nog geen categorien!</font>"; } ?> <tr> <td align="center" colspan="3"> </td> </tr> </table>
Greetz Mathieu:cool:
|