vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Referral question (https://vborg.vbsupport.ru/showthread.php?t=117297)

Ohiosweetheart 06-01-2006 09:36 AM

Referral question
 
Is there a way to reset members' referral counts back to 0?

I ask because we're planning a referral contest, and need an accurate count of how many referrals each member gets.

MickDoneDee 06-01-2006 12:46 PM

You'll probably have to run a database query such as:

DELETE `referrerid`
FROM `user`
WHERE referrerid >0

Before running any DELETE query, I recommend you run a SELECT query first to make sure the correct data will be selected for deletion. eg:

SELECT `referrerid`
FROM `user`
WHERE referrerid >0

Ohiosweetheart 06-01-2006 03:35 PM

Thank you Mick... now i have to figure out how to do this.
Do I simply type what you have above, in the Manual Query in vB?

MickDoneDee 06-01-2006 04:00 PM

Admin CP - Import & Maintenance - Execute SQL Query - Paste query in Manual Query edit box - click Continue

Copy and Paste exactly as below:

SELECT `referrerid`
FROM `user`
WHERE referrerid >0

If you're happy that the correct data has been called then do another query. This time, copy and paste the DELETE version which should call the same data and, hopefully, give you the option of deleting it.

DELETE `referrerid`
FROM `user`
WHERE referrerid >0

Later, you can do another query to determine who received the most referrals.

Ohiosweetheart 06-01-2006 05:54 PM

I'm afraid this isn't working. I typed in exactly what you said:

SELECT `referrerid`
FROM `user`
WHERE referrerid >0

and got this:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'exquisi_vB.user' doesn't exist

Ok, I did this one....

DELETE `referrerid`
FROM `user`
WHERE referrerid >0

and got this:
This query may modify data in your database. If this change is done in error, it is possible that you will not be able to recover from this change. Are you sure you wish to continue?

is that right?

well, I continued, with it... and got another error:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1109
error desc: Unknown table 'referrerid' in MULTI DELETE

MickDoneDee 06-01-2006 06:39 PM

What is your user table prefix?

Ohiosweetheart 06-01-2006 07:19 PM

would that be the vb_ from my config.php file?

MickDoneDee 06-01-2006 07:34 PM

Your config.php file should have something like:

// Prefix that your vBulletin tables have in the database.
// For example: $tableprefix = 'vb3_';
$tableprefix = '';

That is from my config file which shows my tables don't use a prefix. Please paste the same section from your config file so I can see whether your database is using table prefixes.

Ohiosweetheart 06-01-2006 07:41 PM

Ok this is what mine has:

// Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = 'vb_';

also I went into repair/optimize tables in the acp... all the tables have the vb_ in front of them

MickDoneDee 06-01-2006 07:57 PM

Okay, run this query which should show which user currently has the most referrals.

SELECT referrerid, COUNT( username )
FROM vb_user
WHERE referrerid > '0'
GROUP BY referrerid
ORDER BY `COUNT( username )` DESC

If that works, run this query which will update the vb_user table by adding the value '0' in all referrerid fields that currently hold a value greater than '0'. (This is preferable to using the DELETE function.)

UPDATE vb_user
SET referrerid='0'
WHERE referrerid>'0'

After that, run the first query again which should produce no results because all referrerid fields will have the value '0'.

Ohiosweetheart 06-01-2006 07:59 PM

OK! I'm off to try this right now.


EDIT: That did it! Mick, thank you for being so patient with me, and so willing to help.
You're wonderful https://vborg.vbsupport.ru/

MickDoneDee 06-01-2006 08:56 PM

I'm glad it worked. If you have any further mysql related questions or need a query then vBulletin.com has a MySql section.

Ohiosweetheart 06-01-2006 09:00 PM

I noticed that a little while ago. Since I rarely go there, I didn't even think about posting it there. plus I wasn't sure that it was going to be a mysql question, to start with.

thanks again!

ResaleBroker 06-23-2006 10:29 PM

Quote:

Originally Posted by Ohiosweetheart
Is there a way to reset members' referral counts back to 0?

I ask because we're planning a referral contest, and need an accurate count of how many referrals each member gets.

You don't have to reset the member's referral counts. Simply run a report from the UserCP.

MickDoneDee 06-24-2006 08:21 AM

Could you explain the steps to do this, please?

ResaleBroker 06-24-2006 11:40 AM

Quote:

Originally Posted by MickDoneDee
Could you explain the steps to do this, please?

AdminCP >> Users >> Referrals >> Enter the start data and end date.

MickDoneDee 06-24-2006 11:51 AM

Excellent! I never noticed that menu before. Thanks for telling us about it.

ResaleBroker 06-24-2006 12:38 PM

Happy to be of help. :)

Ohiosweetheart 11-05-2006 11:22 AM

Well that info is good news! :D

newforum 06-11-2007 04:49 PM

Quote:

Originally Posted by MickDoneDee (Post 994986)
Admin CP - Import & Maintenance - Execute SQL Query - Paste query in Manual Query edit box - click Continue

Copy and Paste exactly as below:

SELECT `referrerid`
FROM `user`
WHERE referrerid >0

If you're happy that the correct data has been called then do another query. This time, copy and paste the DELETE version which should call the same data and, hopefully, give you the option of deleting it.

DELETE `referrerid`
FROM `user`
WHERE referrerid >0

Later, you can do another query to determine who received the most referrals.

If i click execute sql query it gives an error message as "you are not authorized to execute sql queries". I am admin of this site, so what should i do to remove this error message.

MickDoneDee 06-12-2007 09:07 AM

In your includes folder is the config.php file. Open that file in a text editor and find:
Quote:

// ****** USERS WITH QUERY RUNNING PERMISSIONS ******
// The users specified here will be allowed to run queries from the control panel.
// See the above entries for more information on the format.
// Please note that the ability to run queries is quite powerful. You may wish
// to remove all user IDs from this list for security reasons.
$config['SpecialUsers']['canrunqueries'] = '1';
Enter your userid between the two single quote marks and save. Now you should be able to run queries from the admin cp.


All times are GMT. The time now is 01:52 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.02181 seconds
  • Memory Usage 1,759KB
  • 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
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)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