displaying photos 4 per row
Posted: Fri Mar 02, 2007 8:30 pm
feyd | Please use
any suggestions?
HOW DO I OUTPUT 4 PER ROW?
thanks in advance,
mc
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I know I've seen this here before but don't know where to look...
I want to run a query with a WHILE loop that outputs photos (from a table) four per row and stops when it has no more associated photos...(I'll use tables or CSS to define position)
Say I have ten photos (all the same size) associated with a particular topic ("trucks" , for instance)
I want my result to display:Code: Select all
echo "
<tr><td>truckphoto1</td><td> truckphoto2</td><td>truckphoto3</td><td>truckphoto4</td></tr>
"<tr><td>truckphoto5</td><td> truckphoto6</td><td>truckphoto7</td><td>truckphoto8</td></tr>
"<tr><td>truckphoto9</td><td> truckphoto10</td><td></td><td></td></tr>
";Code: Select all
$$query="SELECT * FROM 'photos' WHERE type='truck'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {thanks in advance,
mc
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]