msbatt Posted November 23, 2009 Share Posted November 23, 2009 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???!!! Link to comment https://forums.phpfreaks.com/topic/182654-displaying-mysql_fetch_array-data-in-a-html-table/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.