vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Post count within a date range (https://vborg.vbsupport.ru/showthread.php?t=63860)

Doc203 04-14-2004 12:08 PM

Post count within a date range
 
On our board we give a prize away every month for the person with the most posts that month.

Right now I go into the database and manually extract the post counts and do the math. I would like to have a hack that would do that for me, and maybe even show under each users profile the number of posts they have so far each month. Then lastly I would like to have a seperate "stats" page that you could see who the top posters were every month for the past however many.

Thanks for any help!

bigdaddy04 04-30-2004 12:53 AM

bump, im interested in this as well..i have created a query for the overall post count but cannot figure out how to retrieve a post count for the current month

bigdaddy04 04-30-2004 04:24 PM

Anyone?

Here is what I have so far: (it returns top10 posters EVER, i want it for the current month)
PHP Code:

$records $DB_site->query("SELECT username,posts FROM user ORDER BY posts DESC LIMIT 10"); 

thanks alot, if someone could just point me in the right direction, would be cool as well.

cheers

Doc203 08-22-2004 01:46 PM

We just need to modify that to a specific date range. I will see what I can find also.

CarCdr 08-22-2004 03:07 PM

You would need to query the 'post' table. search.php contains code to do a similar thing (i.e., when you specify a username and last 30 days). All posts are timestamped. You'll see in there how to manufacture a timestamp 30 days old.

If you do not know the user you are after, this would be very time-consuming, as you'd have to check each user against the post table. Yikes.

Doc203 08-22-2004 03:36 PM

Here is what I have come up with thus far:

Code:

SELECT COUNT(*) AS count FROM post WHERE  post.userid = 1 AND (UNIX_TIMESTAMP('2004-04-02 00:00:00')) <= post.dateline AND post.dateline <= (UNIX_TIMESTAMP('2004-05-04 00:00:00'))

Doc203 08-23-2004 11:57 AM

OK, with a little help I finally came up with this for a query, now on to the rest of it.

Code:

SELECT COUNT(post.postid) AS count, user.username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.userid = 1
AND (UNIX_TIMESTAMP('2004-04-02 00:00:00')) <= post.dateline
AND post.dateline <= (UNIX_TIMESTAMP('2004-05-04 00:00:00'))
GROUP BY post.userid


Doc203 08-23-2004 07:38 PM

Here is What I finall came up with so I could show all users and list them within a certain date range. Now I just need to figure out how to write a script that will let the user select the date range and how to make that work with this script or one similar to it.

Code:

SELECT COUNT(post.postid) AS count, user.username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
AND (UNIX_TIMESTAMP('2004-04-02 00:00:00')) <= post.dateline
AND post.dateline <= (UNIX_TIMESTAMP('2004-05-04 00:00:00'))
GROUP BY user.userid ORDER BY count DESC, username


roundhost 09-01-2004 04:57 PM

i am interested in this also, for vb3 though :p

Doc203 09-01-2004 09:15 PM

I am working on it for VB3. I have gotten the results that I want, I just have to get them to work correctly with a template etc.


All times are GMT. The time now is 03:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02114 seconds
  • Memory Usage 1,733KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete