I am having some problems with the code listed below. I have different directories for various data. I am trying to extract the data from each folder and sort them alphabetically. The problem that I am running into is that one the data is displayed for example from the progress reports folder, that data will also be listed in the from the workplans folder.
example:
Progess Reports:
A
B
C
Work Plans:
A
B
C
XR
CV
FR
I dont know why reading the directory doesnt close after the close() method. Anyone see how to fix this?
Thanks in advance.
Alex
sample code:
<tr>
<td>
<?php
// Progress_Reports
$dirPR = dir($current_dirPR);
echo \"<b>Progress Reports</b><br><br>\";
while ($filenamePR = $dirPR->read())
{
if ($filenamePR != \".\" && $filenamePR != \"..\" && $filenamePR != \".htaccess\") {
$file_array[] = $filenamePR;
}
}
sort ($file_array);
foreach ($file_array as $file) {
echo \"<a href=get_file.php?e=1&file_name=$file>$file </a><br>\";
}
echo \"<br><br>\";
$dirPR->close();
?>
</td>
</tr>
<tr>
<td>
<?php
// Work Plans
$dir = dir($current_dirWP);
echo \"<b>RI/FS and IRAM Work Plan</b><br><br>\";
while ($filenameWP = $dir->read())
{
if ($filenameWP != \".\" && $filenameWP != \"..\" && $filenameWP != \".htaccess\") {
$file_array[] = $filenameWP;
}
}
sort ($file_array);
foreach ($file_array as $file) {
echo \"<a href=get_file.php?e=4&file_name=$file> $file </a><br>\";
}
echo \"<br><br>\";
$dir->close();
?>
</td>
</tr>