Your code makes no sense and the error message is telling you exactly what you did wrong. opendir() returns a directory handle to be passed to readdir(). Calling chdir() on a directory handle makes no sense. You want to chdir to the same string that you passed to opendir()
-Rasmus On Wed, 2 Oct 2002, Nokar wrote: > I get this error from php when i execute this code can you help me ;) > Warning: chdir() expects parameter 1 to be string, resource given in > C:\xxxx\read.php on line 146 > > 145 echo "<center>Attachment :"; > 146 $rep = opendir("C:\\xxx\\Attach\\$id\\"); > 147 chdir($rep); > 148 while ($zone = readdir($rep)) > 149 { > 150 if (!is_dir($zone)) echo "<a > href=\"../Attach/$id/$zone\">$zone</a><br>"; > 151 } > 152 echo "</center>"; > 153 } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php