Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 03-16-2004, 09:24 AM   #1 (permalink)
Junior Member
 
Join Date: 03-15-04
Location: EarthPlanet
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Nasimov is liked by many
Writing to a file. (PHP)

It's possible to ammend data within a file vs. just adding data to the beginning or the end of the file? Mean to change something in the "middle" of the file.
Thanks.
Nasimov is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-16-2004, 09:37 AM   #2 (permalink)
Senior Member
 
fishfreek's Avatar
 
Join Date: 10-13-03
Location: Virginia
Posts: 844
iTrader: 0 / 0%
Latest Blog:
None

fishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of lightfishfreek is a glorious beacon of light
Send a message via ICQ to fishfreek Send a message via AIM to fishfreek Send a message via MSN to fishfreek Send a message via Yahoo to fishfreek
To have a php script that can edit info thats in the middle of another file?

IS that what your getting at?

I think you can but you have to know what line its one and obvously it would have to be data thats always on a given line in that file.

How to do it I cant remember but I belive when I was reading some php books it talked about doint it via the fopen(); and then something pertaning to the line count.
fishfreek is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-16-2004, 12:09 PM   #3 (permalink)
Junior Member
 
Join Date: 02-04-04
Posts: 11
iTrader: 0 / 0%
Latest Blog:
None

bob9999 is liked by many
Re: Writing to a file. (PHP)

The easiest way to do this is to read all of the file into a variable (or array) & manipulate that using search & replace & then write it back to the file.

I hope this helps,

Bob


Quote:
Originally Posted by Nasimov
It's possible to ammend data within a file vs. just adding data to the beginning or the end of the file? Mean to change something in the "middle" of the file.
Thanks.
bob9999 is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-16-2004, 05:42 PM   #4 (permalink)
Senior Member
 
ferret77's Avatar
 
Join Date: 02-10-04
Posts: 476
iTrader: 0 / 0%
Latest Blog:
None

ferret77 is a jewel in the roughferret77 is a jewel in the roughferret77 is a jewel in the roughferret77 is a jewel in the roughferret77 is a jewel in the roughferret77 is a jewel in the roughferret77 is a jewel in the rough
you could use regular expressions also
ferret77 is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing an upload.cgi file... alkawood Coding Forum 4 04-07-2004 06:31 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 04:46 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.