xtheunderdog
Joined: 15 Jun 2004 Posts: 10
|
Posted: Tue Oct 26, 2004 2:08 am Post subject: b2 Stats question and a comments question |
|
|
I've got the stats hack working fine, but I've spent the last few days trying to figure out how to put in the Top Five Posters and the number of posts they have (like the commenters one); however, I cannot for the life of me figure out how to do it. I copied and pasted the query for the commenters and edited for authors and did the same with the output, but it doesn't work.
this is what i tried:
Code: | $tp = "SELECT the_author, COUNT(*) AS 'total' FROM $tableposts GROUP BY the_author ORDER BY total DESC LIMIT 5"; |
and
Code: | // Top 5 Posters
echo "<b>» Top 5 Posters</b><br>\n";
echo "<table border=\"1\" width=\"20%\" cellspacing=\"2\" cellpadding=\"0\">\n";
echo "<tr>\n";
echo "<td><b>No.</b></td>\n";
echo "<td><b>Members' Nickname</b></td>\n";
echo "<td><b>Members' Posts</b></td>\n";
echo "</tr>\n";
// Top 5 Posters - MYSQL
$e = mysql_query($tp) or die(mysql_error());
$i=1;
while ($data = mysql_fetch_row($e)) {
echo "<tr>\n<td>".$i."</td>\n";
echo "<td><a href=\"$siteurl/b2stats.php?user=".$data[0]."\">".$data[0]."</a></td>\n"; // holds the name
echo "<td>".$data[1]."</td>\n</tr>\n"; // holds the number of comments
$i++;
}
echo "</table>\n";
echo "</td>\n</tr>\n</table><br><br>"; |
what am i missing?
also, my other question is how do i get Code: | <?php comment_ID() ?> | to output the number of comments as pertains to a specific post rather than the overall number of comments? For instance, right now, if I comment on a new entry, it will say comment number "20" greater than what it should be... "1". How can I remedy this? |
|