The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
I have been asking this for weeks.
|
|
#3
|
|||
|
|||
|
No joy i take?
|
|
#4
|
|||
|
|||
|
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. |
|
#6
|
||||
|
||||
|
Nice, pulling a random user is very handy actually.
|
|
#7
|
|||
|
|||
|
should have that but pulling it to a template. then you can drop that anywhere on your site.
|
|
#8
|
||||
|
||||
|
MySQL has a rand function as well, though I don't know it off hand. I'm sure it's in the docs somewhere.
|
|
#9
|
|||
|
|||
|
Cheers people - worked a treat
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|