<?php if (!$dir) { echo "Error: Gallery not found! Please contact the webmaster at webmaster@xsiteclub.com"; exit; } if (!$ext) { $ext=".jpg"; } $pics = Array(); $i=0; $handle=opendir($dir); while (($file = readdir($handle))!==false) { if (eregi($ext,$file)) { $pics[$i] = "$file".""; $i++; } } closedir($handle); $total = floor(($i)/5); $extra = ($i)%5; $row = 0; $col = 5; $k = 0; for ($total_row = 0; $total_row < $total; $total_row++){ echo ("<tr align=\"center\">"); for ($x = $k; $x < $col; $x++){ echo (" <td><img src=\"$dir/$pics[$x]\"></td>\n"); } $k = $x; $col += 5; echo ("</tr>"); } if ($extra > 0){ echo ("<tr align=\"center\">"); for($x = $k; $x < $k + $extra; $x++){ echo (" <td><img src=\"$dir/$pics[$x]\"></td>"); } echo ("</tr>"); } ?>
while (($file = readdir($handle))!==false)
that isnt right I think...
while (($file = readdir($handle))!=false) possibly...???
and $col += 5; ???? $col = 5;
and $extra = ($i)%5; $extra = (($i)%5);
Loserx
Hard to guess what answer you want since you didn't say what's wrong. I did notice that you are echoing tr and td tags but never echo the table tags anywhere.