how to clear a .txt file with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jan

    how to clear a .txt file with php

    I'm busy making a very basic and simple content management system wich
    stores the text in a .txt file. now i need to know how i can clear the
    ..txt file.. now it just adds the new text to the .txt file while it
    should replace it!
    I also like to display the old text in the textarea... help me please!
  • Tim Van Wassenhove

    #2
    Re: how to clear a .txt file with php

    On 2003-12-20, Jan <janvanderburgt @hotmail.com> wrote:[color=blue]
    > I'm busy making a very basic and simple content management system wich
    > stores the text in a .txt file. now i need to know how i can clear the
    > .txt file.. now it just adds the new text to the .txt file while it
    > should replace it!
    > I also like to display the old text in the textarea... help me please![/color]


    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    Here you find everything you need to know...

    --
    verum ipsum factum

    Comment

    • DaWaN

      #3
      Re: how to clear a .txt file with php

      to display the old text then open the file for read first
      fopen('filename .txt', 'r') and display the content, then when you wanna
      replace the content with the new text just
      open the file for write and it'll truncate the content.
      fopen('filename .txt', 'w') will do

      --

      =============== ============
      DaWaN
      dawan57@hotmail .com




      "Jan" <janvanderburgt @hotmail.com> wrote in message
      news:541da53e.0 312200506.5f78d b54@posting.goo gle.com...[color=blue]
      > I'm busy making a very basic and simple content management system wich
      > stores the text in a .txt file. now i need to know how i can clear the
      > .txt file.. now it just adds the new text to the .txt file while it
      > should replace it!
      > I also like to display the old text in the textarea... help me please![/color]


      Comment

      Working...