I have this PHP page :
For some reason I can't paste it here properly
I am able to write to file only in the last row, not all rows. As seen above I have tested using echo if I am displaying all content. I do, but for some reason can't write all of it to file.
function fopen() with w+ mode overrides the file because it places the file pointer at beginning of the file.
You want to use a mode instead.
See mode description: http://php.net/manual/en/function.fopen.php