rbosco020475
asked on
Line Breaks in a text file using php
I have a log file that I am writing to using php when certain events happen on my web site project. I can open the file, write the entry, and close it ok, but I cannot seem to figure out how to format the text file so that each entry is on a single line in the document.
The code I am using is:
$fp = fopen("./logfiles/insert_l og.txt", "a+");
if (!$fp) die ("Cannot open database transaction log");
fwrite($fp, "$subdate|$id|$userid|New record created|success ");
fclose($fp);
The result is:
11/24/2006 00:00:00.000|1001|New record created|success 11/24/2006 00:00:00.000|1001|New record created|success 11/24/2006 00:00:00.000|1001|New record created|success
Anyone know how I can make the result look like this format: (One line per insert to the file.)
11/24/2006 00:00:00.000|1001|New record created|success
11/24/2006 00:00:00.000|1001|New record created|success
11/24/2006 00:00:00.000|1001|New record created|success
Thanks
The code I am using is:
$fp = fopen("./logfiles/insert_l
if (!$fp) die ("Cannot open database transaction log");
fwrite($fp, "$subdate|$id|$userid|New record created|success ");
fclose($fp);
The result is:
11/24/2006 00:00:00.000|1001|New record created|success 11/24/2006 00:00:00.000|1001|New record created|success 11/24/2006 00:00:00.000|1001|New record created|success
Anyone know how I can make the result look like this format: (One line per insert to the file.)
11/24/2006 00:00:00.000|1001|New record created|success
11/24/2006 00:00:00.000|1001|New record created|success
11/24/2006 00:00:00.000|1001|New record created|success
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No problem its always the simple things that are the most infuriating :)
ASKER