Page 1 of 1

fopen()

Posted: Fri Aug 17, 2007 10:11 pm
by krraleigh
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 time
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...

And while I am on the subject this code:

Code: Select all

$file_emailErr = @fopen("emailErrorLog.txt", "a") or exit("Unable to open
file!");
$subject = "\n\n" . "Subject: " .$subject .
"\n************************************************************\n";
@fwrite($file_emailErr, $subject);
outputs this text:

Subject: test 2
************************************************************

This code

Code: Select all

if(!$mail->Send()){
   $myString = $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 the
first
example works as it should?

insight always appreciated
thank you
Kevin

Posted: Fri Aug 17, 2007 10:21 pm
by feyd
You can have many files open at any given time. If there are multiple references to the same file, only one will generally be allowed to write to it.

Posted: Sat Aug 18, 2007 9:14 am
by thewebdrivers
can [s]u[/s] you send us the error log file?
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.