homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Retrieve sum of posts over a certain period of time

5+ Year Member

Msg#: 4059715 posted 9:54 am on Jan 13, 2010 (gmt 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.. :)



5+ Year Member

Msg#: 4059715 posted 1:04 pm on Jan 13, 2010 (gmt 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. "'");

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved