Re: deleting a line



Kim André Akerø wrote:

// 1. Join the array to a single string (newlines are already attached)
// 2. Write the updated array to the new file
fwrite($lines_update, join("", $lines);

Missing a closing parenthesis here, but otherwise, yes, something like
this. Though personally I'd check the return value from fwrite() before
you go and do this:

// Remove the old file
unlink("./member.txt");

// Rename the new file to use the old filename, replacing the old file
rename("member-new.txt","member.txt");

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
.



Relevant Pages

  • Re: searching for missing element in an array
    ... What happens if the array was initialized to all -1 values? ... we know that a zero is stored in the slot of the missing number? ... initialization of the array. ... there are n-1 numbers present. ...
    (comp.programming)
  • Re: question about max_readahead for ide devices in 2.4?
    ... Andrew> That's correct - it's all a bit weird. ... sets an entry in the read_aheadarray. ... Or am I missing something else?? ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: array Puzzle (spoiler)
    ... >) The key is that the integers in the input array are sequential, ... > So now you know one value, and the sum of the two others. ... some of the missing values is generally applicable. ... None of these ranges can contain *all* of the missing values, ...
    (comp.programming)
  • Re: searching for missing element in an array
    ... "Suppose we have n numbersand there is an array of size ... which number is missing from the array if ... there are n-1 numbers present. ... which is implied by the phrase "which number is missing" ...
    (comp.programming)
  • Re: How to count skipped numbers?
    ... numbers somewhere (array, table, other file)? ... Use a quick query to count the number of missing records for you, ... INTO tblCountOfMissingRecs ... consecutive integers in an autonumber field. ...
    (comp.databases.ms-access)