note 21063 rejected from function.fwrite by alindeman
| From: | alindeman@php.net | Date: | Sat, 27 Apr 2002 18:55:03 +0000 |
| Subject: | note 21063 rejected from function.fwrite by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-29930@lists.php.net to get a copy of this message | ||
$fd = fopen("wotd.txt", "w") || die ("Can't create the file
wotd.txt");
$input = "testing\\n";
if(fwrite($fd, $input) == -1)
{
die ("Can't write to file wotd.txt");
}
fflush($fd);
fclose($fd) || die ("Can't close the file wotd.txt");
My problem is that this error:
Supplied argument is not a valid File-Handle resource
appears in fwrite, fflush, fclose commands, but if $fd is not valid then I must have failed opening
the file at the first line and see the indicated error message, but in my case this error message
can't be found anywhere.
What's wrong with this piece of code.
Thank you for your helps.