Jump to content

displaying mysql_fetch_array data in a html table


msbatt

Recommended Posts

hi

 

i want to display a picture gallery by using a html table. the image id's are located in a mysql database so i need to call them and display them in multiple rows of the table. i want to display 5 pictures per row but the code i've written (shown below) is showing only 1 picture per row.

 

<?php

$query = "SELECT id FROM dynamicImages ORDER BY id DESC";

$result = mysql_query($query) or die(mysql_error());

while($input = mysql_fetch_array($result))

if(count($input)) { ?>

<table class="portfolio_table" cellspacing="0">

<?php for($i = 0; $i < count($input); ++$i) { ?>

<?php if(!$i) { ?>

<tr><?php } else if(!($i % 5)) { ?></tr>

<tr><?php } ?>

<td><img src="images/upload/dynamic/<?php echo $input[$i]; ?>.jpg" border="0" alt=""/></div></td>

<?php } ?>

</tr>

</table>

<?php } ?>

 

please can somebody help???!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.