Re: [PHP] How can I insert the data into the begining of a text file

2001-08-23 Thread Christian Reiniger
On Wednesday 22 August 2001 18:14, Zenith wrote: I have try this but, PHP just overwrite the prevoius content, and write the new message into the file. But I want to INSERT the new message into the head of a file. You actually have to read everything, insert the line, write everything.

[PHP] How can I insert the data into the begining of a text file

2001-08-22 Thread Zenith
I orginal have a function like the following... $fp = fopen ( $HTTP_SERVER_VARS['DOCUMENT_ROOT']./log/debug_message.txt, a ); fputs ( $fp, \nDebug message from : $PHP_SELF\n ); fputs ( $fp, \t$message\n\n ); fclose ( $fp ); But I found that, the result is, all message is append to the

Re: [PHP] How can I insert the data into the begining of a text file

2001-08-22 Thread Zenith
I have try this but, PHP just overwrite the prevoius content, and write the new message into the file. But I want to INSERT the new message into the head of a file. Or , I did a wrong thing again?? My code is like now. $fp = fopen ( $HTTP_SERVER_VARS['DOCUMENT_ROOT']./log/debug_message.txt, r+ );