note 21063 added to function.fwrite
| From: | requestboy at hotmail dot com | Date: | Sat, 27 Apr 2002 05:14:11 +0000 |
| Subject: | note 21063 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29905@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.
--
http://www.php.net/manual/en/function.fwrite.php
http://master.php.net/manage/user-notes.php?action=edit+21063
http://master.php.net/manage/user-notes.php?action=delete+21063
http://master.php.net/manage/user-notes.php?action=reject+21063