note 42771 deleted from function.rand by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 28 May 2004 20:38:04 +0000 |
| Subject: | note 42771 deleted from function.rand by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70258@lists.php.net to get a copy of this message | ||
Note Submitter:
----
If mysql 3.23.* is having problems getting a random item. Try the following.
$myrand = RAND();
$query="SELECT * from table ORDER by RAND($myrand) LIMIT 1"
I ran in to problems after realising my server was running a different version than I was testing
locally. But after much searching (and trying timestamps with dubious results), I came up with this
simple solution that sorted it.