MyBB Community Forums

Full Version: How to fetch and separate forums from categories?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I fetch and then separate forum names from category names.

Here is my pretty basic code:

<?php

define("IN_MYBB",1);
include("global.php");
	
	$query = $db->simple_select("forums", "*");

	while($posts = $db->fetch_array($query))
	{
	
		
		
		//echo $posts['name']."<br />";
		//echo $posts['fid']."<br />";

	
	$postforumlink = "<a href=\"{$mybb->settings['bburl']}/".get_forum_link($posts['fid'])."\">".$posts['name']."</a>";
	
	if($posts['type'] == 'c')
	{
	$category .= "<div>{$postforumlink}</div>";

	}
	if($posts['type'] !== 'c')
	{
		$forum .= "<div>{$postforumlink}</div>";
	}
}


?>

<html>
<head>
</head>
<body>

<?php
    echo $category;
?>
<br/>
<br/>
<br/>
<br/>
<?php
    echo $forum;
?>

</body>
</html>

Why some results don't have correct URL to the forum?
Seems to work fine for me.
Thanks buddy yeah works on the server but was not working well on localhost but then on localhost my forum is subjected to tests, modifications and all kinds of abuse.