lszanto Posted December 28, 2006 Share Posted December 28, 2006 I have been learning about file commands and such and was having a go at writing to files useing fwrite() but for some reason even if I entered \n at the end of a line it would not write to the text file with a line break but it would just leave everything on the same line, the script is below and all help is appreciated.[code]<?php $file = "myfile.txt"; $fh = fopen($file, 'w') or die("Could not create file"); fwrite($fh, "lszanto\n"); fwrite($fh, "admin\n"); fwrite($fh, "user\n"); fclose($fh);?>[/code] Link to comment https://forums.phpfreaks.com/topic/32018-problem-fwriteline-escape-error/ Share on other sites More sharing options...
kenrbnsn Posted December 28, 2006 Share Posted December 28, 2006 What platform is your webserver running on? If it is Windows, the line break character is [nobbc]"\r\n"[/nobbc].Ken Link to comment https://forums.phpfreaks.com/topic/32018-problem-fwriteline-escape-error/#findComment-148619 Share on other sites More sharing options...
lszanto Posted December 28, 2006 Author Share Posted December 28, 2006 That was the problem thanks for your help. Link to comment https://forums.phpfreaks.com/topic/32018-problem-fwriteline-escape-error/#findComment-148648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.