Reply to Re: Two for { }

Your name:

Reply:


Posted by d on 01/23/06 01:36

"zek2005" <esapoznik@gmail.com> wrote in message
news:1137958840.688392.165190@z14g2000cwz.googlegroups.com...
> Hi friends!!!
>
> I'm stuck with something. I want to show some pictures in my site. Max
> 5 pictures in a row and start a new row. The number of rows must by the
> total numbers of pictures available through the "select" divided by 5
> and applied the ceil function to round up the result. So, I have the
> total number of rows to show. ok, now I have the problem and I copy the
> code to ask you for help. The result of the followin code is the first
> pictures repeated indefinitely.
>
> Thank you very much!
>
> Ezequiel
>
>
> $response = mysql_query("select * from fotografias where decada=1970",
> $dbase);
> if (!$response) {
> die('Invalid query: ' . mysql_error());
> }
> $cantidad= mysql_num_rows($response);
> $hasta=ceil($cantidad/5);
> echo('<center>');
> while($row = mysql_fetch_array($response))
> {
> for ($i=0;$i=$hasta;$i++)
> {
> for ($j=1;$j=5;$j++)
> {
> echo('<img src="' .$row[url]. '" border="0">');
> }
> echo('<br>');
> }
>
> }

Why don't you just loop through all the pictures in one loop, and use "$i %
$columns" to figure out when to start and end a new row. None of that
loops-within-loops stuff ;)

[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

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