Jump to content

[SOLVED] Only displaying 1 row


Ryuujin

Recommended Posts

I have this code to show my forum categories:

function Template_Main_Categories()
{
global $db_prefix;
// Show the forum categories
$result = mysql_query("SELECT * FROM " .$db_prefix. "categories ORDER BY cat_order");
while($row = mysql_fetch_array( $result ))
{
	$cat_id = $row['id'];
	echo '<div class="Forum_Categories">
			<table border="1" width="100%">
				<tr>
					<th colspan="4" class="Table_Header">', $row['cat_name'], '</th>
				</tr>
				<tr>
					<th>Board</th><th>Topics</th><th>Posts</th><th>Last Post</th>
				</tr>';
	$result = mysql_query("SELECT * FROM " .$db_prefix. "forums WHERE cat_parent='$cat_id' ORDER BY forum_order");
	while($row = mysql_fetch_array( $result ))
	{
	echo		'<tr>
					<td>', $row['forum_name'], '</td><td></td><td></td><td></td>
				</tr>';
	}
	echo	'</table>
			<br />
		</div>';
}
}

The database has 2 categories and 2 forums. 1 forum for each category, but it is only printing out 1 category. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/106876-solved-only-displaying-1-row/
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.