PHP HTML table code working but not right.

when i run this script i get this…

item 1 item 1 item 1 item 1
item 2 item 2 item 2 item 2
item 3 item 3 item 3 item 3
item 4 item 4 item 4 item 4
and so on.

what im wanting it to do is…

item 1 item 2 item 3 item 4
item 5 item 6 item 7 item 8
and so on.

What did i do wrong?
please help.

[php]


<?php

// this gets all the files from a folder

$dir=opendir("extra/");
$files=array();
while (($file=readdir($dir)) !== false)
{
if ($file != "." and $file != ".." and $file != "index.php")
{
array_push($files, $file);
}
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo “

”;
for ($i=1; $i<=4; $i++)
{
echo “”;
}
}
}
?>
”;
echo “”;
// $file=implode(’-’,str_split($file,2));
//echo $file=substr($file, 0, -6);
echo $file;
echo “
”;
if($i<4){
echo “
[/php]

PS: sorry if there is more then one of these post i was having problems with my computer.

Hey sorry i also for got to includ that the two lines below does not work with the code as well.

// $file=implode(’-’,str_split($file,2));
//echo $file=substr($file, 0, -6);

the files inside the folder are titled like this ( 010811.pdf all this means is 01-08-11 is the date and .pdf is the file. don’t really need the .pdf on it.

Sponsor our Newsletter | Privacy Policy | Terms of Service