[eluser]Jan_1[/eluser]
I'm working with XAMPP on localhost and do create and update textfiles. But I don't get a word-wrap with \n oder \r\n. What can i do to write line for line in a txt-file?
Code:
// get some ids from the formular
$export_id = $this->input->post('export_id');
// headline in new textfile
$headline = '"zip";"city";"country"'.'\n';
// create new textfile with a headline
write_file('file_path/example.txt', $headline);
// for every id from formular get data from a db-table
foreach($export_id as $id)
{
$this->db->where('export_id', $id);
$query = $this->db->get('persons');
if($query->num_rows()>0)
{
$person = $query->row();
// creating the next line for the textfile and write it in the textfile
$line = $person->export_zip.", ".
$person->export_city.", ".
$person->export_country.'\n';
write_file('file_path/example.txt', $line, 'a');
}
It works, but all the content is in one line. What can I do better?