Re: Warning: 1 is not a valid File-Handle resource - HELP!

From: Date: Sun, 29 Dec 2002 19:53:13 +0000
Subject: Re: Warning: 1 is not a valid File-Handle resource - HELP!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-129605@lists.php.net to get a copy of this message
"Phil Powell" <soazine@erols.com> wrote in message news:021801c2af19$e05909d0$2aaf6244@scandinawa1bo6... Ok, I am a bad coder. :( I can't figure this out at all: $fileID = fopen("nicknames.txt", 'r'); $stuff = fread($fileID, filesize("nicknames.txt")); fclose($fileID); if (strlen($stuff) > 0) $priorNickNewLine = "\n"; $nicks = explode("\n", $stuff); <--snip--> I would recommend you to always check if the file was opened successfully. Simply add this after your fopen.. if ($fileID === false) { // 3 '=' signs checks variable type and value die("Error opening file. $php_errormsg"); // you will need track_errors = ON in php.ini to use $php_errormsg. HTN gamin.

« previous php.general (#129605) next »