Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Retrieve sum of posts over a certain period of time

9:54 am on Jan 13, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:June 30, 2009
votes: 0

Hi all,

I am trying to write a query that involves points from posts. The points are based on characters from posts, so I would like to divide points by posts to find average points-per-post. The only issue is that I installed the points system a decent few years after the forum started, so I need to count the posts starting from a certain date.

I need the query to count the sum of posts, starting from August 2009. The forum software is IPB(if anyone is familiar with it).

Alright, I'll post the relevant columns and see if anyone can assist me with writing the query.

These columns are from the posts table.
-author_id(this will equal a variable, so it should look like this in the query: WHERE author_id=$member_id)
-post_date (the format looks like this: 1159984164, I imagine there is a set of numbers that equals somewhere in november?)

Actually I think that is all the relevant columns for the query. Somehow it needs to count how many times author_id=$member_id appears in the table, starting AFTER a certain date. I queried the database for the post where i announced the points system and found the date I need to count the posts after, it is: '1251386095'.

Thanks in advance. Hope my topic isn't too intimidating.. :)

1:04 pm on Jan 13, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:June 30, 2009
votes: 0

I managed to figure this out by myself. Apologies for not doing the research I should have before hand.

For anyone with the same issue, here is the query:

$query_ppp = ("SELECT COUNT(pid) FROM ibf_posts WHERE post_date > 1251386095 AND author_id='" .$userid. "'");


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members