|
Posted by Kimmo Laine on 06/13/06 06:43
"lorento" <laurente1234@yahoo.com> wrote in message
news:1150128285.586325.74520@y43g2000cwc.googlegroups.com...
> Instead of using array random, use builtin mysql random :
>
> SELECT id,name,text FROM table ORDER by RAND()
>
In the original post he said:
> > Now, I would like to shufle only names...
The names and text should be separated and shuffled. Your solution is just
shuffling the select order which is not what he wanted.
I think something like this could work:
$query1 = "SELECT id,text FROM...";
$result1 = mysql_query($query1);
$query2 = "SELECT name FROM... ORDER BY RAND()";
$result2 = mysql_query($query2);
while((list($id,$text) = mysql_fetch_array($result1)) && (list($name) =
mysql_fetch_array($result2)) ) {
echo"<tags>$id<>$name<>$text</tags>";
}
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|