Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing data to newline in a flat file.

Status
Not open for further replies.

jxfish2

Technical User
Jan 24, 2002
183
US
If I'm writing data to a file, and I want all new records to write, starting at the first position of a new line, how would I do this?

i.e.

record 1 .....................
record 2 .....................
record 3 .....................
etc...

Currently, the records are writing as follows:

i.e.

record 1 .....................record 2 ....................record 3 ......................

How do I get the linefeed in there...
 
Never mind... I figured it out via trial and error...

$record = "${name}:${age}:${race}:${gender}:${status}\n";
$fp = fopen("/tmp/form.out","a");
fputs($fp,$record,strlen($record));
fflush($fp);
fclose($fp);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top