Re: Warning: 1 is not a valid File-Handle resource - HELP!
| From: | Rick Emery | Date: | Sun, 29 Dec 2002 15:21:24 +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-129580@lists.php.net to get a copy of this message | ||
The last line cannot be producing the warning; it does not refer to a file.
Please show us the EXACT error message.
Are you certain the file was opened? Did you try to print $stuff after reading it? Did it have the
info you thought it should?
----- Original Message -----
From: "Phil Powell" <soazine@erols.com>
To: <php-general@lists.php.net>; <talk@nyphp.org>
Sent: Sunday, December 29, 2002 3:08 AM
Subject: [PHP] Warning: 1 is not a valid File-Handle resource - HELP!
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);
The last line produces the Warning.. why? I am trying to read contents from nicknames.txt and split
according to the newline character so that each nickname is an array element.
What did I do wrong? :(
Phil