Date: 07/10/00
- Next message: Andi Gutmans: "Re: [PHP-DEV] Implementation (simple!) operator overloading"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] Extensions calling C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm trying to open a directory and print out all files that have $id in the
filename, but when I use the code below, I get "1 is not a Valid Resource"
on the readdir line. The directory exists, and I think I'm calling it
correctly.
The way the site works is it's one file that has a ?id=whatever in the
address. whatever is then looked up in a database and corresponding data is
pumped out through a template. It seems that sometimes when the page is
reloaded (with or without a different id,) sometimes the directory resource
id doesn't change, and then I get the invalid warning. So, is there a way
to somehow reset the directory resource id? Or maybe have it get a new one
each time? (reliably)
Thanks in advance,
John Fuetsch
# Load Directory Into Array
$dir = "images/thumbs";
$handle=opendir($dir);
while ($file = readdir($handle)) {
if(strstr($file,$id)) {
$images[count($images)] = $file;
}
}
# Clean up and sort
closedir($handle);
sort($images);
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andi Gutmans: "Re: [PHP-DEV] Implementation (simple!) operator overloading"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] Extensions calling C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

