Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with PHP Filesystem
Old 03-03-2008, 10:57 PM Help with PHP Filesystem
Average Talker

Posts: 20
Trades: 0
I believe that PHP's filesystem will fit what I want to do but I am having trouble finding the appropiate items to do the following:

-Delete a selected line from a text file (For Example: Remove line 40 of a 100 line text file. Therefore, what was line 41 is now line 40 and there are now 99 lines in total)

-Add a line to a preexisting text file (For Example: A string is added to the end of the file [A 98 line text file becomes 99 line] or a string is inserted at a selected line of in the file[The string is made line 45 and what was previously line 45 becomes line 46])

-Edit/replace a certain line in a preexisting text file (For Example: Line 34 which says "Hello I am sam" is changed to say "This is John")

If any of you know a function or a method that can do either of these, do tell.
AssistantX is offline
Reply With Quote
View Public Profile Visit AssistantX's homepage!
 
 
Register now for full access!
Old 03-04-2008, 12:42 AM Re: Help with PHP Filesystem
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
You're going to have to read up on fopen (http://us.php.net/manual/en/function.fopen.php) fget and related functions on php.net.

Especially pay attention to contexts if you plan to edit files on a remote server as you have to specify the context in order to open a file for writing across ftp.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-04-2008, 01:37 AM Re: Help with PHP Filesystem
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Please stop taking up this inobvious sht and use regular database. Some day you will want to sort the data and you WILL have to use db, so why not start using it right now.

But if for some reason you insist on using text files then treat your files as array (by reading them with file()) and use array functions to operate them.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Help with PHP Filesystem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11574 seconds with 12 queries