Thread: PHP Issues.
View Single Post
Old 09-05-2009, 21:42   #1
Druchii
cf.mega poster
 
Druchii's Avatar
 
Join Date: Mar 2006
Location: Oslo, Norway.
Age: 37
Services: Canal Digital: 50/10
Posts: 7,577
Druchii has a nice shiny star
Druchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny starDruchii has a nice shiny star
PHP Issues.

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 (
== 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 (
== 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 =)
Druchii is offline   Reply With Quote