You are here: mission impossibile (for me) « PHP Programming Language « IT news, forums, messages
mission impossibile (for me)

Posted by Ja NE on 06/12/06 14:58

hello (again).
here is something I have slighlty idea how to do, but so far (after few
days) I haven't found the right way to do it.

have a mysql query for id,name,text and than, in while loop I'm printing
those data. that is easy part.
Now, I would like to shufle only names...

so, I have, for example:

1, john, some text;
2, mony, some other text;
3, nick, yet another text;
4, adry, one more text line;

and would like to have:

1, nick, some text;
2, adry, some other text;
3, john, yet another text;
4, mony, one more text line;

I think I would need to create some (one or more? first dilema)
array(s)...

for short, solution I have:
$query = "SELECT id,name,text FROM...";
$result = mysql_query($query);
while(list($id,$name,$text) = mysql_fetch_array($result)) {
echo"<tags>$id<>$name<>$text</tags>";
}

....and than to shufle names array...
for short, one of ideas (doesn't work...):

while(list($id,$name,$text) = mysql_fetch_array($result)) {
$namearr[$id] = $name;
sort($namearr);
$textarr[$id] = $text;
sort($textarr);
}
shufle($namearr);
foreach($namearr as $id => $name) {
foreach($textarr as $id => $text) {
echo"<tags>$id<>$name<>$text</tags>";
}
}

don't kill me please, php is only hobby for me...
tnx for any solution :)

--
Ja NE
http://fotozine.org/?omen=janimir
--

 

Navigation:

[Reply to this 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

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