Reply to Re: fopen()

Your name:

Reply:


Posted by Rik on 08/18/07 04:03

On Sat, 18 Aug 2007 04:37:29 +0200, Kevin Raleigh <kraleigh@sbcglobal.ne=
t> =

wrote:

> Is there something that says that I can only have only one file
> open at a time?
>
> The reason I ask is if I run two file open connections at the same tim=
e
> my emailAddresses.txt file is read, but none of my emails are sent.
> All of the data ends up in my error_file_log.txt. If I comment out the=

> second fopen() stream used for my error log my email program
> works fine. Very strange behavior...

Should be no problem unless you get a variable clash...
This works perfectly:

<?php
$a =3D fopen(dirname(__FILE__).'/a','w');
$b =3D fopen(dirname(__FILE__).'/b','w');
fwrite($a,'This is a');
fwrite($b,'This is b');
fclose($a);
fclose($b);
?>


> And while I am on the subject this code:
> $file_emailErr =3D @fopen("emailErrorLog.txt", "a") or exit("Unable to=
open
> file!");
> $subject =3D "\n\n" . "Subject: " .$subject .
> "\n************************************************************\n";
> @fwrite($file_emailErr, $subject);
>
> outputs this text:
>
> Subject: test 2
> ************************************************************
>
> This code
> if(!$mail->Send()){
> $myString =3D $emailAdd . "\t" . $myName . "\n";
> fwrite($file_emailErr, $myString);
> }
> outputs this text:
> kraash@mysite.net
> Kevin
> asdf@asdf.com
> Jone
> qwer@asdfa.net
> Jack
> kraash@mysite.net
> Kevin
>
> Why is the name written to a newline in the second code example, but t=
he
> first
> example works as it should?

2 options:
1. There's a newline char in $emailAdd.
2. There is no actual newline, it's just how it looks due to wrapping in=
=

the viewport.
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация