Jump to content

Php Forum Build Help needed


Del

Recommended Posts

I need help in building my forum because to view the categorys and forums i've used While then in the middle of that while another while making it not work because there it will only got thru the second while once due to the first one not reapeating cause it doesn't know it has to, Anyone got any Ideas and ask if i should post my script on
Link to comment
https://forums.phpfreaks.com/topic/5838-php-forum-build-help-needed/
Share on other sites

[code]<?
include("dbconnect.php");
$a=0;
$b=0;
?>
<table cellpadding="0" cellspacing="0" width="430" style="border-color: #000000; border-width: 1px;">
<?
while($a < $catnum) {

$cat=mysql_result($catresult,$a,"name");
?>
<tr>
<td width="206" style="border-bottom: solid; border-left: solid; border-top: solid; border-width: 1px;"><font face="Verdana" size="2">&nbsp;<b><? echo $cat; ?></b></font></td>
<td width="70" align="center" style="border-bottom: solid; border-left: solid; border-top: solid; border-width: 1px;"><font face="Verdana" size="1">Post Num</font></td>
<td width="85" align="center" style="border-bottom: solid; border-left: solid; border-top: solid; border-width: 1px;"><font face="Verdana" size="1">Thread Num</font></td>
<td width="150" align="center" style="border-bottom: solid; border-left: solid; border-top: solid; border-right: solid; border-width: 1px;"><font face="Verdana" size="2">Latest Post:</font></td>
</tr>
<?
$a++;
$forumquery="SELECT * FROM forums WHERE catgroup='$cat' ORDER BY `ordernum` ASC";
$forumresult=mysql_query($forumquery);
$forumnum=mysql_num_rows($forumresult);

while($b < $forumnum){

$catname=mysql_result($forumresult,$b,"name");
$description=mysql_result($forumresult,$b,"description");
?>
<tr>
<td width="206" style="border-bottom: solid; border-left: solid; border-width: 1px;"><font face="Verdana" size="2">&nbsp;<b><? echo "$catname</b><br>$description"; ?></font></td>
<td width="70" align="center" style="border-bottom: solid; border-left: solid; border-width: 1px;"><font face="Verdana" size="1">Post Num</font></td>
<td width="85" align="center" style="border-bottom: solid; border-left: solid; border-width: 1px;"><font face="Verdana" size="1">Thread Num</font></td>
<td width="150" align="center" style="border-bottom: solid; border-left: solid; border-right: solid; border-width: 1px;"><font face="Verdana" size="2"><? echo "$cat -- $catname || "; ?></font></td>
</tr>
<?
$b++;
}
echo "<tr><td>&nbsp;&nbsp;</td></tr>";
}
?>
</table>[/code]
Thats my Code and at the top there is While and in that While is another While

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.