Author Topic: Deleting from a txt file  (Read 366 times)

99wesley99

  • New Member
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Deleting from a txt file
« on: June 25, 2012, 03:57:10 PM »
PHP Code: [Select]
<?
    $gb_file 
fopen"guests.txt""a+" );
    if ( 
fwrite($gb_file"$name\t$email\n") ) {
        
$body  "My message Text...\n";
        
$body .= "$name\n";
        
$body .= "$email\n";
        
mail"my_email@my_domain.edu","Guest Book Entry"$body );
        echo 
"Thanks!<br>\n";
    }
    else {
        echo 
"could not write file...<br>\n";
    }
?>


I would really like to be able to delete entries out of the txt file this writes to. Does anybody know how to do this or create functions to delete?

RaythXC

  • PHP Programmer & Web-Designer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 395
  • Karma: 10
  • Freelance PHP Programmer/Web-Designer
    • View Profile
    • Rayth.Info
Re: Deleting from a txt file
« Reply #1 on: June 25, 2012, 06:32:38 PM »
Duplicate post and in wrong section. Closed this one after replying to other one.
RaythXC - My Home Site
Note: most answers I give come from the php manual located at PHP.Net