boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

b2 Stats question and a comments question

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
xtheunderdog



Joined: 15 Jun 2004
Posts: 10

PostPosted: Tue Oct 26, 2004 2:08 am    Post subject: b2 Stats question and a comments question Reply with quote

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group