RE: [PHP-WIN] Help!

From: Date: Wed, 14 Mar 2001 23:03:27 +0000
Subject: RE: [PHP-WIN] Help!
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-6037@lists.php.net to get a copy of this message
Oops, I just realized that range() doesn't even work in PHP 4.0b2. Ack! > -----Original Message----- > From: Robin Bolton [mailto:rbolton@lonepinepublishing.com] > Sent: March 14, 2001 3:53 PM > To: php-windows@lists.php.net > Subject: [PHP-WIN] Help! > > > 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
« previous php.windows (#6037) next »