neroag wrote:what im trying to do is get is all the photo's in a directory to display in a table 5 wide and however many down depending on the number of photo's in the directory
1 2 3 4 5
6 7 8 9 10
etc etc
I think you can do something like this:
<?php /* I think this might work */ ?>
<table border="0" cellpadding="10" cellspacing="0" align="center" width="100%">
<tr>
<?php
// put filenames in array, with index/key '1' at start:
$filenames = array(1=>'one','two', 'three', 'four', 'five', 'six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen');
$i = 1;
while ($i <= count($filenames)) {
$photoname = ($filenames[$i] . ', ' . $i);
echo '<td>' . $photoname . '</td>' . "\n";
if ($i % 5 == 0){ // 5
echo '</tr>' . "\n" . '<tr>' . "\n";
}
$i++;
}
?>
</tr>
</table>