cookspyder Posted July 23, 2007 Share Posted July 23, 2007 looking to write to a file with out overwriting the previous data? is there a way to turn overwrite off with the file put contents?? im trying to keep a log of form data. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 23, 2007 Share Posted July 23, 2007 Try the FILE_APPEND flag. Quote Link to comment Share on other sites More sharing options...
stlewis Posted July 24, 2007 Share Posted July 24, 2007 Just open the log file in apend mode; fopen($file,"a+"); Whatever you write to the existing file is placed at the end...done. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 24, 2007 Share Posted July 24, 2007 file_put_contents("filename",$variable, FILE_APPEND) will do it in one shot, though; you don't need to fopen/fwrite/fclose. Quote Link to comment Share on other sites More sharing options...
stlewis Posted July 26, 2007 Share Posted July 26, 2007 Hmm...I didn't know that, and it's much more efficient... 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.