PDA

View Full Version : DB Query to get a users postcount # in the past 24 hours?


007
03-21-2003, 11:24 PM
Hi, I have tried a few things and none of them worked. I am trying to show the number of posts each user has made in the past 24 hours in their profile. I know there is a simple query for this because I have seen versions of it in some hacks here. I just couldn't modifiy those to work with my forums for some reason. All I need is the query.

Please help. :)

Chris Gwynne
03-21-2003, 11:39 PM
There's a default variable within vB that will show the average amount of posts for that user, per day. Will that help you? :)

007
03-21-2003, 11:44 PM
I was looking for that but couldn't find it. That would be a start I think... Do you know where it is?

N!ck
03-22-2003, 12:40 AM
If you're OK to add another query to whatever page that is, use:


$cutoff=time()-86400;
$postcount=$DB_site->query_first("SELECT COUNT(*) AS total FROM post WHERE userid='$userid' AND dateline >= $cutoff");


Then insert $postcount[total] where you need it to appear.

007
03-22-2003, 03:57 AM
Thanks N!ck! That was it. Yeah I'm jsut using it for the getinfo page so there's not too much to worry about query-wise. Thanks.

:)