fwrite($handle, $new_info\r);

as quoted above would indicate $new_info\n as been a variable..

try

$new_info .= "\n";
fwrite($handle, $new_info);

this will add \n to the end of the string before you write it...

hope this helps

--------------------------------------------------------- 
Chris Kay 
Techex Communications 
Website: www.techex.com.au Email: [EMAIL PROTECTED] 
Telephone: 1300 88 111 2 - Fax: 1300 882 221 
---------------------------------------------------------  

-----Original Message-----
From: Guru Geek [mailto:[EMAIL PROTECTED]] 
Sent: Monday, 10 February 2003 9:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP] appending file with new line first

Hello,

Yep, me again, with yet another php question.
Maybe I'm too tired to see the easy solution...

I open a file and write to it:
   $handle = fopen ($temp_file, 'a');
   fwrite($handle, $original_info);
   fclose ($handle);

Later I want to add to the above file:
   $handle = fopen ($temp_file, 'a');
   fwrite($handle, $new_info);
   fclose ($handle);

Here's what the file now looks like:
original info
original info
original info
original info
new infonew info

I'm trying to achieve:
original info
original info
original info
original info
new info
new info

It writes the very first piece of new info on a new line.  That is
good.  The second piece of new info gets written right at the exact end
of the file.  I've tried fwrite($handle, $new_info\n) but that creates
an error.  So does  fwrite($handle, $new_info\r);

How can I get the new info to go on its own line in the file?

Thanks,
Roger



-- 
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

Reply via email to