or you could code it like this:
$file_pointer = fopen('/public_html/emails.txt', "a")
if (!$file_pointer) exit;
-----Original Message-----
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 2:34 PM
To: Richard Emery
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Last time Append line to text file
On Sun, 28 Apr 2002, Richard Emery wrote:
> The answer is:
> $file_pointer = fopen('/public_html/emails.txt', "a") or exit;
>
> The " || " is a binary operation. You want "or", the logical operation.
Yeah, Perl habit.
But || is logical too (it's | that's binary), it just seems to result in
$file_pointer being recast from 'resource' to 'boolean' for some reason.
This side effect is not mentioned at
http://www.php.net/manual/en/language.operators.logical.php where it
imples that the only difference is precedence. I'd say this is a bug
either in the manual or in PHP itself.
miguel
> ----- Original Message -----
> From: Rodrigo <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; 'Miguel Cruz' <[EMAIL PROTECTED]>; 'John
> Holmes' <[EMAIL PROTECTED]>
> Sent: Sunday, April 28, 2002 10:55 PM
> Subject: [PHP] Last time Append line to text file
>
>
> Ok, but I'm trying the following code wich is basicaly the same Miguel
> sent me and I still get the same message.
> Please excuseme for being so repetitive but � don't seem to see where is
> the mistake, Sorry guys for the trouble.
>
> <?php
>
> $file_pointer = fopen('/public_html/emails.txt', "a") || exit;
> $string_to_write = ("$newemail") . "\n";
> fwrite($file_pointer, $string_to_write);
> fclose($file_pointer);
>
> ?>
>
>
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/restricted/home/h4ck3r/public_html/write.php on line 4
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/restricted/home/h4ck3r/public_html/write.php on line 6
>
>
>
>
--
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