Quote:
Originally posted by jameshsi
Hi!
Can you make a little bit modify to let the result with
how many threads like this:
Category xx (230)
Category yy (300)
Category zz (20)
|
I figure out, and paste here in case someone needs it:
<?php
require("/path/to/your/admin/config.php3");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM category ";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
$countid = $latest_array[categoryid] ;
$q1 = "select * from forum where categoryid=$countid";
$howmany = mysql_query($q1,$db);
$counter="0";
while ($count_array = mysql_fetch_array($howmany)) {
$counter = $counter + $count_array[threadcount];
}
echo "<FONT SIZE=\"1\" FACE=\"Arial\">??
<A HREF=\"http://yourdomain/forum/index.php3?categoryid=$latest_array[categoryid]\">$latest_array[title]</A>($counter)</FONT><BR>";
}
?>
Since I am a newbie on PHP coding, please let me know if you know there is a better way to do this.