Unholy Prayer Posted November 24, 2006 Share Posted November 24, 2006 Ok, I'm making my own forum software for my website and I am stuck. I have it working somewhat, but it only displays the first category and the forums that are in it. Can someone please help me fix this? Here is my forums page: http://www.mtechdev.com/bbultimate/index.php and here is my code:[code]<?phprequire_once('config.php');//Let's start the category selection.$result = mysql_query("select * from categories");while($r=mysql_fetch_array($result)){ $id=$r["id"]; $name=$r["name"]; $description=$r["description"]; echo "<table align='center' width='95%' cellspacing='1' cellpadding='1' style='background-color: #000000;'> <tr> <td align='center' colspan='2' style='background-color: #e4e4e4;'><p align='left'><b>$name</b>- $description</p></td> </tr>";//Now we find the forums for the selected category.$result = mysql_query("select * from forums where cid = $id order by fid");while($r=mysql_fetch_array($result)){ $fid=$r["fid"]; $forumname=$r["forumname"]; $fdescription=$r["description"]; $cid=$r["cid"]; echo "<tr> <td align='left' style='background-color: #e4e4e4;'>$forumname<br>$fdescription</td> </tr>"; } echo "</table>"; } ?>[/code] Link to comment https://forums.phpfreaks.com/topic/28292-er-making-forum-need-help/ Share on other sites More sharing options...
marcus Posted November 24, 2006 Share Posted November 24, 2006 You should different queries for each category.[code]$cat1 = mysql_query("SELECT * FROM categories WHERE id=1");$cat1a = mysql_query("SELECT * FROM forums WHERE cid=1 ORDER BY fid");etc....[/code] Link to comment https://forums.phpfreaks.com/topic/28292-er-making-forum-need-help/#findComment-129379 Share on other sites More sharing options...
Unholy Prayer Posted November 24, 2006 Author Share Posted November 24, 2006 Ok, I'll try it.Edit: Ahh, thanks. That worked. Link to comment https://forums.phpfreaks.com/topic/28292-er-making-forum-need-help/#findComment-129418 Share on other sites More sharing options...
marcus Posted November 24, 2006 Share Posted November 24, 2006 No problem. Link to comment https://forums.phpfreaks.com/topic/28292-er-making-forum-need-help/#findComment-129422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.