I've created a guestbook for a website and want to clear it out and start with no entries. I have searched for an answer on how to do this and have had no luck. How do I clear the test entries from the guestbook?

    seems like a one of thing so you don't need to use php, just delete it or empty it with a text editor, on the server assuming *nix you can use touch. If you really want to do it with php

    unlink ('file.txt');file_put_contents('file.txt','');

    or fopen ..

      The [man]fopen/man option dagon referred to would be opening the file with the 'w' flag (since this truncates the file to zero length) and then calling [man]fclose/man immediately afterwards.

      Also note that [man]file_put_contents/man will, by default, overwrite the file's contents, so if you went with that route you could omit the call to [man]unlink/man.

        Write a Reply...