im in a nightmare here with count. i have 2 categorys. cat with id 1 and cat with id 2,
now everything display right except for the row count cat with id 1 has 2 topics and cat with id 2 has 1 topic but it displays record count of 3 on both cats
[php]$sql = “SELECT * FROM forums, forum_categories WHERE forum_categories.cat_id = forums.cat_id ORDER BY forums.forum_id DESC”;
$result = query($sql);
$topics_count = row_count($result);
$displayedCategories = array();
while (($row = mysqli_fetch_assoc($result)) != false) {
if (!in_array($row['cat_id'], $displayedCategories)) {
$cat_id = $row['cat_id'];
$cat_title = $row['cat_title'];
$displayedCategories[] = $row['cat_id'];
$forum_name = $row['forum_name'];
$forum_last_post_id = $row['forum_last_post_id'];
echo "<tr>";
echo "<td>$cat_id</td>";
echo "<td><a href='viewforum.php?f={$cat_id}'>$cat_title</a><br>$forum_name Admin</td>";
echo "<td>$topics_count</td>";
echo "<td>0</td>";
echo "</tr>";
}
} [/php]