If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > displaying mysql_fetch_array data in a html table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-09, 10:45
msbatt msbatt is offline
Registered User
 
Join Date: Nov 2009
Posts: 3
displaying mysql_fetch_array data in a html table

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???!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On