Re: shuffle
| From: | Torsten Roehr | Date: | Wed, 14 Jul 2004 18:20:00 +0000 |
| Subject: | Re: shuffle | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190519@lists.php.net to get a copy of this message | ||
"Edward Peloke" <epeloke@echoman.com> wrote in message
news:NKEFLLFBJFIKEGAGKPCAGEECDIAA.epeloke@echoman.com...
> I am using a db class which has the following method for cycling through
the
> records
>
> function nextRecord(){
> $this->record=@mysql_fetch_array($this->queryID);
> $status=is_array($this->Record);
Hi Edward,
first you are using $this->record and then $this->Record (r / R)?
Have you tried adding this line?:
shuffle($this->record);
> return ($status);
> }
>
> where queryID is set by running the query. It works fine and I can run it
> as follows
>
> $sql->query("select * from clients");
> while ($sql->nextRecord()){ echo $sql->getField("name");}
>
> Problem is, I want to have the array shuffled so the rows are randomly
> displayed each time the user hits the page. I have tried shuffle around
the
> @mysql_fetch_array call and $this->queryID but nothing seems to work...any
> ideas?
>
> Thanks,
> Eddie
Regards, Torsten Roehr