Below is my code for the question mentioned in the title:
$folder = '/net/comp/home/data/';
$files1 = scandir($folder);
$analysisno=($row['ANALYSIS_NUMBER']); //e.g.11wa666
//if ($test = strstr($folder,'$analysisno'))
if (in_array($analysisno,$files1))
{
//echo " --$test completed, match found";
echo " <td BGCOLOR=\"#00ff00\">completed</td>\n";
}
else
{
echo " <td BGCOLOR=\"#00ffff\">pending</td>\n";
The if statement does not seem to work correctly, as when testing: there is a file in the directory above which contains an analysis number which the if statement should check and output completed. ( this is the problem).
( All I would like to do is check if a file with the analysis number in its filename is present in the directory specified then output 'completed' if there is no existance of the analysis number in the folder then output queued).
By default the code always outputs 'pending' and does not output completed when necessary.
Thanks for any help.