RE: [PHP] appending file with new line first

From: Date: Sun, 09 Feb 2003 22:18:30 +0000
Subject: RE: [PHP] appending file with new line first
Groups: php.general 
Request: Send a blank email to php-general+get-134986@lists.php.net to get a copy of this message
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: chris.kay@techex.net.au Telephone: 1300 88 111 2 - Fax: 1300 882 221 --------------------------------------------------------- -----Original Message----- From: Guru Geek [mailto:gurugeek2002@g-i-w-s.com] Sent: Monday, 10 February 2003 9:13 AM To: php-general@lists.php.net 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

« previous php.general (#134986) next »