Help!
| From: | Robin Bolton | Date: | Wed, 14 Mar 2001 22:52:40 +0000 |
| Subject: | Help! | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-6036@lists.php.net to get a copy of this message | ||
Ok, I've managed to get pretty far stuck using MySQL 3.22 and PHP 4.0b2
for a project I'm working on, however I was hoping someone could help me
with a problem that's probably really simple to fix, just can't get my
head around it right now.
I need to pull 25 items out of a database randomly with no repeats. Since
I'm using MySQL 3.22 I can't use 'ORDER BY RAND()' and PHP4.0b2 doesn't
support the 'shuffle()' function (which apparently doesn't work too well
anyways.)
What I've got so far is:
for($i = 1; $i < 26; $i++) {
$rArray[$i] = rand(1,count(range(1,25)));
}
however, that causes repeats. So the bottom line is I need an array with
25 values (1 to 25) sorted randomly without repeats, and only using PHP
4.0b2 and earlier functions.
Thanks in advance,
Robin Bolton
Lone Pine Publishing
www.lonepinepublishing.com
rbolton@lonepinepublishing.com
sillyboy@mindless.com
Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s