vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need some MySQL help please (https://vborg.vbsupport.ru/showthread.php?t=45635)

Unknown553 11-11-2002 08:49 PM

Need some MySQL help please
 
I've set up a referral contest on my forum and recently we cought someone cheating and registering multiple accounts, so we set up a new rule; referrals only count after they post 10 posts.

So I have a leaderboard set up which is almost the exact code from the admin CP (user.php?action=referrers more specifically). It shows me how many referrals have been aquired for referrers in a specific time period. But now how do I make it so that it only shows me the referred members with 10+ posts?

The query I have now is

[sql]$users = $DB_site->query("SELECT COUNT(*) AS count, user.username, user.userid FROM user AS users
LEFT JOIN user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
$datequery
GROUP BY users.referrerid
ORDER BY count DESC");[/sql]

It doesn't show up, but in that blank space between WHERE and GROUP BY is the date query, currently a variable right now.

Any ideas? Thanks in advance.

Xenon 11-12-2002 04:35 PM

this should be enough:
Code:

$users = $DB_site->query("SELECT COUNT(*) AS count, user.username, user.userid FROM user AS users
                  LEFT JOIN user ON (users.referrerid = user.userid)
                  WHERE users.referrerid <> 0 AND user.posts > 9
                 
                  GROUP BY users.referrerid
                  ORDER BY count DESC");


Unknown553 11-12-2002 09:54 PM

Well first off you didn't select the posts row in the query before using it, and second, I tried that. The problem is that I'm trying to count only the referrALS that have 10+ posts, not the referrERS that have 10+ posts. The query you posted only displays the referrERS with 10+ posts. Thanks but it doesn't work. :(

Unknown553 11-20-2002 04:06 AM

Anyone? Please?


All times are GMT. The time now is 01:46 PM.

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.01044 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete