You are here: Re: random pic - does not ALWAYS show « PHP Programming Language « IT news, forums, messages
Re: random pic - does not ALWAYS show

Posted by Kimmo Laine on 01/25/07 07:44

"Tobi Hammert" <speichern@gmail.com> wrote in message
news:1169688138.621201.85300@a75g2000cwd.googlegroups.com...
>i just want to show up a random pic.
>
> <?
> $files = glob("./gfx/zufall/*");
> shuffle ($files);
> if (count($files) < 1)
> $count = count($files);
> else
> $count = 1;
> for ($i = 0; $i < $count; $i ++)
> {
> $file = $files[$i];
> echo "<a href='index.php'><img src='$file' height='341'
> width='634' border='0'></a>";
> }
> ?>
>
> it works fine, just ocasionally, it shows NO pic.
> whats wrong? that is, how can i solve it?

On those rare occasions when it doesn't work, have you looked at the source
code to see what the output was? print_r($files); to see if . and .. are
included in the file list. If they are, those might be casusing your
problem. If not, see the output when it doesn't work and try to figure what
went wrong. Another guess would be non-ascii characters in filenames don't
translate to url, like characters with umlauts or stuff like that.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация