RE: [PHP] More array syntax
| From: | John W. Holmes | Date: | Sun, 09 Mar 2003 05:29:25 +0000 |
| Subject: | RE: [PHP] More array syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138835@lists.php.net to get a copy of this message | ||
> here is a tricky question , as i've probably said work is still using
php3
> and
> mysql 3.22 which has no random select function , and the only way i
can
> randomise results is place them into an array and use shuffle ,
although
> shuffle will not randomise on a two dimensional array , how can i get
this
> to
> work in php3 i have to call the microtime seed function first before
> shuffle
> it works for one dimensional arrays?
Can't you just count the array and then choose a random number below the
count?
Won't
SELECT *, RAND() r FROM your_table ORDER BY r;
work for you?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/