stelthius Posted July 9, 2009 Share Posted July 9, 2009 Hellow guys, im just wondering if anyone can shed some light on my forum display issue, ive tried everything to get my forum to put a break like <br> before each new category but for the life of me cant figure it out any help is appretiated. <?php $contentOutput .= "<table width='500' height='100' cellpadding='0' cellspacing='0' align='center' summary='' border='1'> <tr> <td>Forum</td> <td>Threads</td> <td>Posts</td> </tr>"; $getCats = mysql_query("SELECT * FROM forum_cats ORDER BY sort_order"); while($cat = mysql_fetch_array($getCats)) { $getForums = mysql_query("SELECT * FROM forum_forums WHERE cat_id='".$cat['cat_id']."' ORDER BY sort_order"); $contentOutput .= "<tr> <td>".$cat['title']."</td> </tr>"; while($forum = mysql_fetch_array($getForums)) { $getThreads = mysql_query("SELECT * FROM forum_threads WHERE for_id='".$forum['for_id']."'"); $countThreads = mysql_num_rows($getThreads); $posts = mysql_fetch_array($getThreads); $getPosts = mysql_query("SELECT * FROM forum_posts WHERE thr_id='".$posts['thr_id']."'"); $countPosts = mysql_num_rows($getPosts); $contentOutput .= "<tr> <td><a href='index.php?page=community&option=threads&id=".$forum['for_id']."'>".$forum['title']."</a></td> <td>$countThreads</td> <td>$countPosts</td> </tr>"; } } $contentOutput .= "</table><br>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/165395-solved-forum-display-table-help/ Share on other sites More sharing options...
ignace Posted July 9, 2009 Share Posted July 9, 2009 This code was missing colspan="3" $contentOutput .= "<tr><td colspan=\"3\">".$cat['title']."</td></tr>"; To add a break-line type of thing you'll need to add an empty row as <br> won't do much in a table context. This will create a "break" before every category. $contentOutput .= "<tr><td colspan=\"3\"> </td></tr><tr><td colspan=\"3\">".$cat['title']."</td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/165395-solved-forum-display-table-help/#findComment-872307 Share on other sites More sharing options...
stelthius Posted July 9, 2009 Author Share Posted July 9, 2009 Hey ignance, the thing is i tried that but then that gives me a break before the table header which holds Forum | threads | Posts so would i in theory need two tables to acheive what im trying to do ? if so do you have any idea how ? Quote Link to comment https://forums.phpfreaks.com/topic/165395-solved-forum-display-table-help/#findComment-872311 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.