2

I build a csv with php,

but at the moment I have the problem that it will not break the line in the .csv file.

I have this:

$users = $row['COL 1']."".$row['COL 2']."".$row['COL 3']."".$row['COL 4'];

This is what I tried:

$users = $row['COL 1']."\n\r".$row['COL 2']."\n\r".$row['COL 3']."\n\r".$row['COL 4'];

I want to get after the line break a new column not a new row. Something like this:

  | A                          |
__|____________________________|
1 | name 1 <-line break here   |
  | name 2 <- this shall happen|
_______________________________|

but it did not work, please need some help:)

Unis Da
  • 33
  • 6
  • 2
    Why aren't you using PHP's built-in [fputcsv()](http://www.php.net/manual/en/function.fputcsv.php) function? – Mark Baker Nov 06 '15 at 15:11
  • If you look on it in a browser notice that you cannot see the line breaks, in this case put `header("content-type: text/plain")` on top – Philipp Dahse Nov 06 '15 at 15:14
  • @PhilippDahse doesn't matter how to open the file, new lines inside a cell need to be escaped or otherwise they will corrupt the whole table. – Daniel W. Nov 06 '15 at 15:45

0 Answers0