Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.