note 42325 deleted from function.readdir by tularis
| From: | tularis@php.net | Date: | Sun, 13 May 2007 19:05:20 +0000 |
| Subject: | note 42325 deleted from function.readdir by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126540@lists.php.net to get a copy of this message | ||
Note Submitter: abanner at netachievement dot co dot uk
----
Whilst writing a script to check a directory to see whether certain files existed, I used an
original example from this page and modified so that in the first loop that checks the directory,
there is a second that looks at a database recordset and tries to find the matches.
I found an issue that I have not yet solved. I am not a PHP guru, so I might be missing something
here.
In the parent loop, $file is set correctly. As soon as your progress to the inner loop, $file
becomes just a full stop (.) - I've no idea why.
<?
if ($handle = opendir($path)) :
while (false !== ($file = readdir($handle))) :
// Here $file is set correctly
while($row = @ mysql_fetch_array($result)) :
// Here $file is set to .
endwhile;
endwhile;
closedir($handle);
endif;
?>