Re: Generating a table

From: Date: Fri, 15 Sep 2000 01:40:53 +0000
Subject: Re: Generating a table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16882@lists.php.net to get a copy of this message
On Fri, 15 Sep 2000, o.cook@etoncollege.org.uk wrote: > I have a database that contains image filenames and a comment associated > with each one. > > I'm trying to work out how to generate a table that will display a thumbnail > of each picture with the comment underneath, 3 images per row. > > For the life of me I can't work out a decent logic for this! > > Currently I'm using: > > ....... > <ol> > <? > $sql = "SELECT filename, comment, x, y FROM photos_france"; > $result = mysql_query($sql,$conn); > while($row = mysql_fetch_array($result)) { > $x = $row['x']; > $y = $row['y']; > echo "<li><a onMouseOver=\"status='$row[comment]'; return > true\" > onMouseOut=\"status=''; return true\" onClick=\"openWindow($ > </ol> > ....... > > But I want to jazz it up a bit ;) > > Ollie Use the modulus operator; count the number of records processed and when you reach a multiple of three, start a new row in the table, otherwise just start a new cell. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#16882) next »