Forum
Subscribe


Select a Random User

How to Choose Truly Random Users
Sometimes you may wish to pick a user at random, say for a random payout. Here's how.

From the admin menu, choose Database Utilities | MySQL Admin
Now click the button at the top marked 'Query'
Enter into the box the following code: select username from users where pay_type!="" order by rand(); and click the button marked 'Execute Query'.

The result will be a list of members chosen in random order.

The above query will list all members whose payment account type is not blank in their user profile. If, instead, you wanted a list in random order of only the users who have selected a particular payment type. e.g. Paypal, you could use this code instead:

For Stormpay: select username from users where pay_type="stormpay" order by rand();

For Paypal: select username from users where pay_type="paypal" order by rand();
And so on.

If you wish to create a list in random order of only the users who have selected a particular interest keyword, use the following format:
select users.username from users left join interests on users.username=interests.username where pay_type!="" and keywords like "%|PUTKEYWORDHERE|%" order by rand();