Click to See Complete Forum and Search --> : Editing the Text file


arpit_vavadia
10-12-2008, 12:22 PM
I have a text file which has the recrod(s) as follows
xx,xxx,xxx,xxx
xx,xxx,xx,xxx
xx,xxxx,xxxxx

Now how can I pick a particular row of data and edit and save it . So that when next when the record(s) are displayed the updated records as show

thank's

NogDog
10-12-2008, 12:37 PM
One way:

$lines = file('file/to/be/edited.txt');
// loop through array $lines or otherwise manipulate it as desired, then...
file_put_contents('file/to/be/edited.txt', implode('', $lines));