<?php
if( isset($_GET['cattodisplay']) ) {
$cat[] = urldecode( $_GET['cattodisplay'] );
}
include 'news/index.php';
?>
<?php
$query = "
SELECT
DISTINCT(SELECT COUNT(storyid) FROM news30_groupcats WHERE type = 'news'
AND catid = news30_cats.id) AS totalposts,
name,
news30_cats.id as catid
FROM news30_cats
LEFT JOIN news30_groupcats ON news30_cats.id = news30_groupcats.catid
ORDER BY news30_cats.name
";
$results = DataAccess::fetch($query);
foreach($results AS $row) {
echo '<A HREF="yourpage.php?cattodisplay=' . urlencode( $row['name'] ) . '">' .$row['name'] . '</A> ('. $row['totalposts'] .' article(s))<BR />';
}
?>