Hi all,
I've been having trouble to delete a line from a TXT-file for days.
The content of the text file just like below:
---------------------------begin==>
00145|test|line1
00255|test|line1
01143|test|line1
00469|test|line1
10146|test|line1
--------------------------<==end
Every line begins with a random number.I read the file (named THIS.TXT) from a simple
program just like this:
---------------------------begin==>
$news=file("this.txt");
$num=count($news);
echo "<TABLE borderColor=#ffffff cellSpacing=0 cellPadding=0 width=100%
bgColor=#efefef border=1>";
for($i=0;$i<$num;$i++)
{
$message=explode("|",$news[$i]);
$id=$message[0];
$title=$message[1];
$time=$message[3];
$bgcol = (($i % 2) == 0) ? "CCCCCC": "EEEEEE";
echo "<tr bgcolor='#{$bgcol}'><td>※ <a href=zcfgcont.php?id=$id>$title</a></td><td>";
echo "<a href=del.php>DELETE THIS LINE</a>";//HOW TO WRITE THIS LINE??HOW TO achieve
the function?
echo "</td></tr>";
}
echo "</table>";
--------------------------<==end
#################################################
*********The PROBLEM is:How to WRITE A FILE named del.php or WRITE A FUNCTION() to
delete this line?
My opinion is to read the content to a array and write any line but" $id=$id" line,but
I delete all the content by this,what should I do?
It's the first time I ask a question by the MAIL-LIST,my Enlish is poor,sorry.
Thank you very much in advance.
poetbox
[EMAIL PROTECTED]
2003-06-03
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php