I'm having some issues using PHP to dynamically create a table...
Basically it reads imagenames from a folder, then creates a table and has 3 items per row. It creates a new row every 3 items, or should... That's the problem, the "<tr>"'s and "</tr>"'s never get printed...
Here's the code:
PHP Code:
<?php
$i = "0";
$Folder = "./Photos/";
$DirHandle = @opendir($Folder) or die($Folder." could not be opened.");
print ("<table width=40% align=center valign=center>");
while ($Filename = readdir($DirHandle))
{
if (i == 2) print ("<tr>");
if (($Filename != ".") AND ($Filename != "..")) print ("<td width=200 height=200><img src=\"$Folder$Filename\" height=95% width=95%>$i</img></td>");
if (i == 2) print ("<\tr>");
if (($Filename != ".") AND ($Filename != "..")) ++$i;;
}
closedir($DirHandle);
print ("</table>");
?>
Any ideas?
Also, sorry for any particularly bad code, i'm just learning
Also, this can be tested at:
http://revts.ath.cx while i am online (Pass: Password)
EDIT: Also, the 0 never shows beneath the first image...
EDIT2: Fixed the 0 never being shown... Code above amended (used i == instead of i =)