Location: PHPKode > scripts > WH Board > wh_board/modules/all_categories.php
<?php

    $sql = "SELECT
    			categories.cat_id,
    			categories.cat_name,
    			categories.cat_description,
    			COUNT(topics.topic_id) AS topics
    		FROM
    			categories
    		LEFT JOIN
    			topics
    		ON
    			topics.topic_id = categories.cat_id
    		GROUP BY
    			categories.cat_name, categories.cat_description, categories.cat_id
    		ORDER BY
    			categories.cat_id ASC";

    $result = mysql_query($sql) OR die(mysql_error());

    if(!$result) {

    echo '<p class="false">' . $lang['no_categories'] . '</p>' . mysql_error();

    	}else{

    	if(intval(mysql_num_rows($result)) == 0) {

    	echo '<p class="false">' . $lang['no_categories'] . '</p>';

    }else{

    echo '<ol class="categories">';

    while($row = mysql_fetch_assoc($result)) {

        echo '<li><a href="category.php?id=' . (int)$row['cat_id'] . '" class="categories">' . htmlentities($row['cat_name'], ENT_QUOTES) . '</a></li>';
        }

    echo '</ol>';
    }
    }

?>
Return current item: WH Board