Re: Can I delete / update line inside the file ?
| From: | Philip Olson | Date: | Thu, 23 May 2002 02:19:56 +0000 |
| Subject: | Re: Can I delete / update line inside the file ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98857@lists.php.net to get a copy of this message | ||
> I am thinking - I will take the data in an array first - change it and
> flush back to file again. Is there any command to flush back the whole
> array in to file (each array element will become one line) or do I need to
> write one by one line ?
see file() and implode() where you'll implode by "\n".
Regards,
Philip Olson
>
>
> manisha
>
> At 04:59 AM 5/23/02 +0300, you wrote:
> >Get a database working! That's definitely worth investing some time in -
> >apart from the obvious speed avdantages, you'd learn a lot.
> >
> >About your question, AFAIK you can only do it by reading from one file and
> >writing to a temp file, then moving the temp over the original - pretty
> >clumsy, if you ask me... ;-)
> >
> >Bogdan
> >
> >Manisha wrote:
> >
> >>Hi,
> >>
> >>I have one file with following format
> >>
> >>No. | Name | Email | status
> >>1 | Manisha | manisha@aurica.com | Pending
> >>2 | Neha | neha@hotmail.com | Reject
> >>3 | Aish | aish@yahoo.com | Pending
> >>
> >>.......
> >>
> >>I want to update status change against that line. e.g For sr no 1 - I
> >>want to change the status from Pending to Accepted. I read about the
> >>fseek / fwrite command, but did not came across the delete the line from
> >>file. I believe fseek command will write a line starting from pointer but
> >>will not overwrite.
> >>
> >>I am using PHP3 and no database is available (That's the main problem).
> >>And many times I need to seek the record (line) , change it and store back.
> >>
> >>I may be asking some silly questions as I am very very new to PHP. Please
> >>bear with me.
> >>
> >>Thanks in advance
> >>
> >>Manisha
> >>
> >>
> >>
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>