RE: [PHP] Shuffling a mySQL Result Set
| From: | John Coggeshall | Date: | Sun, 30 Jul 2000 18:56:24 +0000 |
| Subject: | RE: [PHP] Shuffling a mySQL Result Set | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9125@lists.php.net to get a copy of this message | ||
Oh, very true...
But then again, you could still use Shuffle and do something like this.
<?
while(($myarray = mysql_fetch_array($result)) $mixer[] = $myarray;
shuffle($mixer);
?>
Had to redeem myself ;)
John
John Coggeshall wrote:
>
> $result = mysql_query ("SELECT id FROM table WHERE id in (1,2,3,4)");
> $myarray = mysql_fetch_array($result);
>
> shuffle($myarray);
That would shuffle the order of the columns for that row, not the order of
the rows. So, each time you get a row, it would have the columns in
different places. Probably not the desired effect.
Ben was right on, using the right query in MySQL is the way to go.
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
More than just answers. Solutions. (SM)
http://www.analysisandsolutions.com/
4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net