kevonini Posted March 13, 2012 Share Posted March 13, 2012 It's been a while since I've dealt with text files and currently I am unable to write the contents of a variable to a text file, only the literal is being written. Should I be de-referencing or is this even possible? Also the problem is compounded by the fact that i also want to write the contents of a class display function into the text file. Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/ Share on other sites More sharing options...
ManiacDan Posted March 13, 2012 Share Posted March 13, 2012 You're probably single-quoting the variable, which won't work. that's all we can say without looking at code. Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326904 Share on other sites More sharing options...
kevonini Posted March 13, 2012 Author Share Posted March 13, 2012 That seemed to be it but now the newline feature is not working...would I need to modify something in the .ini file fwrite($handle, $name."\n"); Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326972 Share on other sites More sharing options...
Pikachu2000 Posted March 13, 2012 Share Posted March 13, 2012 How are you determining that \n isn't working; how are you displaying the data? Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326974 Share on other sites More sharing options...
kevonini Posted March 13, 2012 Author Share Posted March 13, 2012 inside the text file the data is being shown beside each other Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326975 Share on other sites More sharing options...
Pikachu2000 Posted March 13, 2012 Share Posted March 13, 2012 Try using the php end-of-line constant and see if that makes a difference. fwrite($handle, $name . PHP_EOL); Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326976 Share on other sites More sharing options...
kevonini Posted March 13, 2012 Author Share Posted March 13, 2012 Thanks ..that did the trick Link to comment https://forums.phpfreaks.com/topic/258841-writing-variables-to-a-text-file/#findComment-1326979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.