<?php
$file_name = 'test.txt';
$line_no_to_delete = 2;

$f = fopen($file_name, 'rw+');
$s = explode("\n", fread($f, filesize($file_name)));
unset($s[$line_no_to_delete - 1]);
fseek($f, 0);
fputs($f, implode("\n", $s));
fclose($f);
?>

"Kris Vose" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
How would you go about deleting a specific line in a textfield via PHP?  For
example, I want to delete line 2 only and save the changes.  How would I go
about doing this using fopen and fwrite?

Kris




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to