Re: Text file wont' have newlines?
| From: | Torsten Roehr | Date: | Sat, 29 May 2004 23:18:22 +0000 |
| Subject: | Re: Text file wont' have newlines? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187209@lists.php.net to get a copy of this message | ||
"Ashwin Purohit" <ampurohit@hotmail.com> wrote in message
news:BAY14-F15JE51w86skq0001a5f7@hotmail.com...
> Hi everybody,
>
> I have this script in a file that allows users to upload files, and I want
> to know who submitted what so I write $userfile_name and $credit1(their
> name) to CREDIT.txt in the same directory like so :
>
> $credit = $userfile_name.': '.$credit1."\n";
> $fp = fopen('CREDIT.txt','a');
> fwrite($fp, $credit);
> fclose($fp);
>
> But every new submission ends up on the same line, there is never a line
> break in the text. Any suggestions?
Try "\r\n" or chr(10):
$credit = $userfile_name.': '.$credit1."\r\n";
$credit = $userfile_name.': '.$credit1.chr(10);
Regards, Torsten