Jump to content

php order by rand()...


phpnoobie9

Recommended Posts

It will already have about a 50% chance of showing because there are only 2 choices. Choosing something randomly doesn't necessarily mean that you'll get a different one of the 2 words each time. You could get one word 3 times in a row then the other one 5 times in a row.

 

If you really want to show the other word each time the page loads, set some flag on the words and change it between the two each time.

 

rand(0,1) means pick a random number between 0 and 1.

Link to comment
https://forums.phpfreaks.com/topic/98187-php-order-by-rand/#findComment-502368
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.