![]() |
Pulling a random member from my subscribed users.
Right :
Scenario : I wish to run a monthly draw for subscribed members. One will be pulled every month randomly. Whats the easiest (and fairest) way to do this. Is there an SQL command which will give me a random subscribing member userid? Any input appreciated. |
I have been asking this for weeks.
|
No joy i take?
|
Quote:
rand({min},{max}) So rand(2, {users}) will return a random number that isnt 1. For not two in a row DO $rand1 = rand(2, {users}) $rand2 = rand(2, {users}) UNTILL $rand1 !== $rand2 Something like that. Google search "php rand". -{users} could be replaced with the variabe for total users in database. |
|
Nice, pulling a random user is very handy actually.
|
should have that but pulling it to a template. then you can drop that anywhere on your site.
|
MySQL has a rand function as well, though I don't know it off hand. I'm sure it's in the docs somewhere.
|
Cheers people - worked a treat ;)
|
All times are GMT. The time now is 08:43 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|