Jump to content

[SOLVED] Forum display table help


stelthius

Recommended Posts

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>";
?>

Link to comment
https://forums.phpfreaks.com/topic/165395-solved-forum-display-table-help/
Share on other sites

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>";

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.