php-general | 2001032
Date: 03/25/01
- Next message: Philip Olson: "Re: [PHP] URL parsing"
- Previous message: Richard: "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- In reply to: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Next in thread: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Reply: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Re-create the file. You're most of the way there.
if( $formSubmit )
{
echo "Your news has been processed.";
$filename = "news.txt";
//This is simpler than messing with an array of the original content.
$fp = fopen ($filename, "r");
$newsSubmit = fread ($fd, filesize ($filename));
fclose ($fp);
$fp = fopen( $filename, "w" ); // change append to write (a to w)
fwrite( $fp, $frmName ); //write the new
fwrite( $fp, $newsSubmit); //write the old
fclose( $fp );
}
else
{
include ( "newsForm.php" );
}
if you want to use fseek, then try this:
if( $formSubmit )
{
echo "Your news has been processed.";
$filename = "news.txt";
//This is simpler than messing with an array of the original content.
$fp = fopen ($filename, "r+");
$newsSubmit = fread ($fd, filesize ($filename));
fseek($fp,0);
fwrite( $fp, $frmName ); //write the new
fwrite( $fp, $newsSubmit); //write the old
fclose( $fp );
}
else
{
include ( "newsForm.php" );
}
""Dddogbruce ( <email protected>)"" <ddogbruce <email protected>> wrote in message
news:3ABE423F.C7709DEB <email protected>
> Ok, with this fseek..
>
> Could you give me an example of how to implement it?
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Philip Olson: "Re: [PHP] URL parsing"
- Previous message: Richard: "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- In reply to: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Next in thread: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Reply: Dddogbruce \( <email protected>\): "Re: [PHP] [PHP4] $fp = fopen( "news.txt", 'a' ); // 'a' = append! Wah!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

