note 42325 added to function.readdir
| From: | abanner at netachievement dot co dot uk | Date: | Wed, 12 May 2004 09:04:28 +0000 |
| Subject: | note 42325 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69512@lists.php.net to get a copy of this message | ||
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;
?>
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42325
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42325&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42325&report=yes
Search -- http://master.php.net/manage/user-notes.php