Reply to Re: mission impossibile (for me)

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация