yortzec Posted February 4, 2010 Share Posted February 4, 2010 I feel really stupid. I want to write to a file starting at the beginning of the second line of a file, and completely ignore the first line, no matter how many characters the first line has. I'm sure this isn't all too difficult in PHP. I also want to end the 2nd line with a line break. What's the best way to do all of this? P.S. I keep hearing different things about what the best way to write a line break is. Do you guys have opinions? Thanks so much! Link to comment https://forums.phpfreaks.com/topic/190983-write-to-2nd-line-of-file-probably-very-easy/ Share on other sites More sharing options...
trq Posted February 4, 2010 Share Posted February 4, 2010 Is there a third line? if not you can just use the 'a' mode argument to fopen to append to the previous line. Link to comment https://forums.phpfreaks.com/topic/190983-write-to-2nd-line-of-file-probably-very-easy/#findComment-1007102 Share on other sites More sharing options...
yortzec Posted February 5, 2010 Author Share Posted February 5, 2010 Yes. I'm planning for there to be one "entry" from a user per line, for organizational purposes only. I guess I could leave it all on the 2nd line, but I may end up with over a hundred "entries." That would be frankly annoying when trying to edit one entry in the middle. Link to comment https://forums.phpfreaks.com/topic/190983-write-to-2nd-line-of-file-probably-very-easy/#findComment-1007116 Share on other sites More sharing options...
ignace Posted February 5, 2010 Share Posted February 5, 2010 Why would you emulate a db if you can just use a db? Link to comment https://forums.phpfreaks.com/topic/190983-write-to-2nd-line-of-file-probably-very-easy/#findComment-1007506 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.