mcloan Posted November 25, 2006 Share Posted November 25, 2006 If I am using fwrite to write to a file, what is the best way to find the next blank row in the file so that it does not overwrite data already in the file?Your help is much appreciated. Thank you. Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/ Share on other sites More sharing options...
kenrbnsn Posted November 25, 2006 Share Posted November 25, 2006 Open the file for append. When you start writing, all new records will be appended to the file.Ken Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/#findComment-130217 Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 The file pointer is always moved to the end of the file, if you open it in 'a' mode. You can also use fseek ( $io, 0, SEEK_END ); when you might be using 'r+' mode.printf Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/#findComment-130219 Share on other sites More sharing options...
simcoweb Posted November 25, 2006 Share Posted November 25, 2006 You can also use the fopen with the 'a' parameter which appends to the last row. The 'w' mode overwrites the entire file AND appends to the last row. Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/#findComment-130224 Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 [quote author=simcoweb link=topic=116289.msg473739#msg473739 date=1164488984]You can also use the fopen with the 'a' parameter which appends to the last row. The 'w' mode overwrites the entire file AND appends to the last row.[/quote]very good [b]simcoweb[/b], I got my w mixed up, good catch! Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/#findComment-130226 Share on other sites More sharing options...
simcoweb Posted November 25, 2006 Share Posted November 25, 2006 Thanks to you and so many others...i'm learning! Link to comment https://forums.phpfreaks.com/topic/28459-fwrite/#findComment-130235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.