I’m new, dumb, and need help. I’m a beginner who has tried to teach myself PHP via on-line tutorials and general trial-and-error. Right now I’m looking to output a directory’s contents such that they are sorted in a table, however long needed to encase said contents but capping off a row after including four files. So, if I had a directory of 26 files comprised of the letters of the alphabet, it should look like:
A B C D
E F G H
I J K L
M N O P
Q R S T
U V W X
Y Z
I’ve been trying slight variants of this to get it done:
[php]<?php
echo “<table cellspacing=“5”>”;
echo “
$rowcount=4;
foreach (glob(“data/*.txt”) as $filename) {
include($filename);
echo "
if ($x%4==0) {
if ($rowcount%2==0){
echo “
echo “
}
else{
echo"
echo “
}
$rowscount++;
}
}
echo “
echo “”;
?>[/php]
The above mess isn’t working, which is probably obvious to everyone here. If anyone would kindly point me in the direction where I can learn how to sort such output, I’d greatly appreciate it. Everything I seem to come across references building tables with PHP using MySQL, but these are flat files I’m working with.