Jump to content

Why doesn't this work? :S


Andy11548

Recommended Posts

I've joined querys because I'm making my own forums. However, when it gets to the echoin out part, it shows the category and only ONE of the sub categorys.

 

<div id="forumContainer">
<?php
	$lastboard = '';

	$forumQ = mysql_query("SELECT

						   f1.cat_name as catName,
						   f1.cat_id as catID,
						   f2.cat_id as subCatID,
						   f2.sub_id as subID,
						   f2.sub_name as subName,
						   f2.sub_desc as subDesc
						   
						   FROM `forum_cats` as f1
						   		LEFT JOIN `forum_sub` as f2
						   			ON f1.cat_id = f2.cat_id
						   GROUP BY f2.cat_id
						   ");
						  
	while($forumF = mysql_fetch_assoc($forumQ))
	{
		if($forumF['catName'] != $lastboard)
		{
			echo '<div class="forumCat">'.$forumF['catName'].'</div>';
			$lastboard = $forumF['catName'];
		}
		echo '<div class="forumSub">'.$forumF['subName'].'</div>';
	}
?>
</div>

Link to comment
https://forums.phpfreaks.com/topic/258200-why-doesnt-this-work-s/
Share on other sites

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.