At 05:27 18.02.2003, Lynn said: --------------------[snip]-------------------- >Could anyone please tell me what a valid argument would be in this script? > > >error message >Warning: Invalid argument supplied for foreach() in >/home1/domains/$domain/htdocs/image.php on line 334 > > >line 323-343 > > >$dg = opendir("$thumb"); >echo "<HTML><HEAD><TITLE>$title</TITLE><META NAME=Description CONTENT='Page >Generated with ScriptCoders AutoThumbs V2.01 >http://www.scriptcoders.com'></HEAD>"; >PrintHeader(); >echo "<center><br><img src=/content/images/br.gif><br><br>"; >echo "<center><table border=0 width=90% ALIGN=CENTER VALIGN=CENTER><tr >ALIGN=CENTER VALIGN=CENTER><td ALIGN=CENTER VALIGN=CENTER>"; >while ( gettype($file = readdir($dg)) != boolean ) > { > if (! is_dir("$file")) >$retVal[count($retVal)] = $file; >} >closedir($dg); >foreach ($retVal as $newFile) --------------------[snip]--------------------
You never explicitly "declare" $retval here. In case the while-loop is executed, $retval is implicitly initialized as an array, but if the while-loop fails to run, $retval is undefined, hence the error. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php