Grodo Posted July 27, 2007 Share Posted July 27, 2007 I can write to one line but cant get it to do multiple of them $csv_mailformat = file to write to $fcsv_itemmaildata = The string that contains information to be written $csv_mailformathandle = the pointer I am really confused on why this wont work Cheers, Grodo // Format Mail $csv_mailformathandlecode] Link to comment https://forums.phpfreaks.com/topic/62071-solved-cant-get-php-to-write-multiple-lines/ Share on other sites More sharing options...
Grodo Posted July 27, 2007 Author Share Posted July 27, 2007 // Format Mail $fcsv_itemmaildata = "\"$db_name\"\n\"$db_company\"\n\"$db_email\"\n\"$db_phone\"\n\"$db_address\"\n\"$db_address2\"\n\"$db_city\"\n\"$db_state\"\n\"$db_country\"\n\"$db_zip\"\n"; if (is_writable($csv_mailformat)) { if (fwrite($csv_mailformathandle, $fcsv_itemmaildata) === FALSE) { echo "Cannot write to file $csv_mail"; exit; } } fclose($csv_mailformathandle); Link to comment https://forums.phpfreaks.com/topic/62071-solved-cant-get-php-to-write-multiple-lines/#findComment-309019 Share on other sites More sharing options...
kiss-o-matic Posted July 27, 2007 Share Posted July 27, 2007 Are you on windows? Is your server? Try \r\n for linebreaks. Link to comment https://forums.phpfreaks.com/topic/62071-solved-cant-get-php-to-write-multiple-lines/#findComment-309024 Share on other sites More sharing options...
Grodo Posted July 27, 2007 Author Share Posted July 27, 2007 hmmmm that didnt work However this works but only does one line $csv_itemmaildata = "\"$db_name\",\"$db_company\",\"$db_email\",\"$db_phone\",\"$db_address\",\"$db_address2\",\"$db_city\",\"$db_state\",\"$db_country\",\"$db_zip\"\n"; if (is_writable($csv_mail)) { if (fwrite($csv_mailhandle, $csv_itemmaildata) === FALSE) { echo "Cannot write to file $csv_mail"; exit; } } Link to comment https://forums.phpfreaks.com/topic/62071-solved-cant-get-php-to-write-multiple-lines/#findComment-309031 Share on other sites More sharing options...
Grodo Posted July 27, 2007 Author Share Posted July 27, 2007 Problem solved I Guess .csv files dont like the \n return Changed it to a txt doc and it works like a charm. Thanks Kiss o Matic for your efforts... Cheers $f_data = "\"$db_name\"\n\"$db_company\"\n\"$db_email\"\n\"$db_phone\"\n\"$db_address\"\n\"$db_address2\"\n\"$db_city\"\n\"$db_state\"\n\"$db_country\"\n\"$db_zip\"\n"; if (is_writable($csv_mailformat)) { if (fwrite($csv_mailformathandle, $f_data) === FALSE) { echo "Cannot write to file $csv_mail"; exit; } } Link to comment https://forums.phpfreaks.com/topic/62071-solved-cant-get-php-to-write-multiple-lines/#findComment-309044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.