You are here: Re: displaying a varying number of images.. in tables?! « PHP Programming Language « IT news, forums, messages
Re: displaying a varying number of images.. in tables?!

Posted by Geoff Berrow on 07/29/05 17:29

I noticed that Message-ID: <r5cke1dmbml3ch23pfaa3omdqga87d07n5@4ax.com>
from Geoff Berrow contained the following:

>Probably not the most elegant way but...
>
Forgot to get rid of the debugging

$result=mysql_query($sql);

$row[0]="";
$columns=3;
$i=0;
$j=0;
print "<table>\n";
while($myrow=mysql_fetch_array($result)){

if($i==0 || $i%$columns!==0){
$row[$j].=" <td>".$myrow['myfield']."</td>\n";
$i++;
}
else{
$j++;
$row[$j]="";
$row[$j].=" <td>".$myrow['myfield']."</td>\n";
$i++;
}
}
while($i%$columns!==0){
$row[$j].=" <td>&nbsp;</td>\n";
$i++;
}
foreach($row as $value){
print " <tr>\n$value </tr>\n";
}
print"</table>";
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

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

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