delete data from txt file in php

delete data from txt file in php

Page 1 of 1

4 Replies - 6737 Views - Last Post: 06 August 2008 - 09:39 PM Rate Topic: -----

#1 dadaso  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 09-June 08

delete data from txt file in php

Posted 06 August 2008 - 03:20 AM

i want delete data from txt file in php.
how do it??
waiting.........................
Is This A Good Question/Topic? 0
  • +

Replies To: delete data from txt file in php

#2 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: delete data from txt file in php

Posted 06 August 2008 - 05:25 AM

Keep waiting ...
Was This Post Helpful? 0
  • +
  • -

#3 Moonbat  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: delete data from txt file in php

Posted 06 August 2008 - 05:57 AM

I'm not sure of any built-in function(s) to delete data from a .txt file. So I would simply file_get_contents() the file, use str_replace to find your line of text and replace it with "" (aka delete it).

After you do that, I'd delete the old file with unlink(), then use fopen mode 'a+' to recreate it. After that, put the new contents in that newly created file, and there you have it :D

I did something similar to this in one of my snippets:
http://www.dreaminco...snippet2238.htm

EDIT: Just so you know, putting things like "waiting.........." in your post won't increase your chances of getting a good answer. If anything, it may decrease your chance.

This post has been edited by Moonbat: 06 August 2008 - 05:58 AM

Was This Post Helpful? 0
  • +
  • -

#4 akozlik  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 90
  • View blog
  • Posts: 797
  • Joined: 25-February 08

Re: delete data from txt file in php

Posted 06 August 2008 - 10:44 AM

Quote

EDIT: Just so you know, putting things like "waiting.........." in your post won't increase your chances of getting a good answer. If anything, it may decrease your chance.


Looking for a response from dadaso . . .

waiting...................
Was This Post Helpful? 0
  • +
  • -

#5 dadaso  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 09-June 08

Re: delete data from txt file in php

Posted 06 August 2008 - 09:39 PM

View Postakozlik, on 6 Aug, 2008 - 10:44 AM, said:

Quote

EDIT: Just so you know, putting things like "waiting.........." in your post won't increase your chances of getting a good answer. If anything, it may decrease your chance.


Looking for a response from dadaso . . .

waiting...................


After posting i found the code for that problem . Then what's problem for writing keyword waiting
it does not mean that you decrease your writing answer.
if you understand problem and you have answer that problem then it increase
your potential skills and satisfaction is also importent because we help someone ...
waiting........
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1