ballhogjoni Posted July 6, 2007 Share Posted July 6, 2007 Is there a way to write records and keep them organized to a file instead of a DB? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 its a pain in the ass but www.php.net/fopen www.php.net/fwrite You have to have a "split" to the line and put each record on a new line. The split needs to be something that won't be in the text so something like :||: would be your splitter: jack:||:John Barker:||:May 22nd 207:||:Jack, Likes having the moon! Just be wary that if someone uses the :||: in the text it could break it, so you may want to replace that with something before you combine them together. Quote Link to comment Share on other sites More sharing options...
Asday Posted July 6, 2007 Share Posted July 6, 2007 Good luck keeping them organised, but here's how to write. // Open to stream $fp $fp=fopen("file.txt", "r+b"); // Take out the b in "r+b" if you're not hosting on windoze // File needs to exist $string="What to write to file"; fwrite($fp, $string); // (stream, content) // I believe that that appends. If you want it to not append, I recommend deleting it, then re-creating it, with unlink, touch. Hope this helps. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 6, 2007 Author Share Posted July 6, 2007 Thank you, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.