<?php
define('SQL_HOST','localhost'); // Connect to your mySQL database
define('SQL_USER','xxx');
define('SQL_PASS','xxx');
define('SQL_DB','xxx');
$link = mysql_connect(SQL_HOST,SQL_USER,SQL_PASS)
or die('Could not connect to the mysql server...; ' . mysql_error());
mysql_select_db(SQL_DB,$link)
or die('Could not select database...; ' . mysql_error());
$query = mysql_query("SELECT COUNT(*) AS totalposts FROM news30_story WHERE catid='6'"); //Change the catid here to the id of your category that you want to count the posts for. To find out the id for your category go to the news admin panel, go to the categories page proceed to scroll over your category then look in the status bar of your browser, the last number is your category id
$query = mysql_fetch_array($query);
$number = $query['totalposts'];
echo $number;
?>
<?php
$catname = 'Cat2';
$query = mysql_query("SELECT COUNT(*) FROM $newstable INNER JOIN $newscats ON $newstable.catid = $newscats.id WHERE $newscats.name = '$catname'");
?>