ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
Re: [PHP-DB] Text file (rw) question...
by Peter Beckman other posts by this author
Mar 14 2006 4:20PM messages near this date
Re: [PHP-DB] Text file (rw) question... | Re: [PHP-DB] Text file (rw) question...
"pear install Config"

Now you can load a config file like that with a single command, load it
into an array, modify values, then write it back.

http://pear.php.net/package/Config

It is fantastic.

Beckman

On Tue, 14 Mar 2006, Rob W. wrote:

>  That works, but it just throws it in to a big loop and fills up the file, any 
>  suggestions?
> 
> 
>  ----- Original Message ----- From: "Chris" <dmagick@[...].com>
>  To: "Rob W." <rob@[...].com>
>  Cc: <php-db@[...].net>
>  Sent: Tuesday, March 14, 2006 5:54 PM
>  Subject: Re: [PHP-DB] Text file (rw) question...
> 
> 
> > Rob W. wrote:
> >> Ok, The fix is just doing something like this...
> >> 
> >> list($variable, $data) = explode("=", $x);
> >> 
> >> But now my problem is trying to figure out how to update that data with 
> >> <form> post ect...
> >> 
> >> So the main page would get
> >> 
> >> MaxUser=32
> >> 
> >> It would read that info and put it in to a form field, which I have.
> >> 
> >> Now I gotta get it to take and make it so that a new value can be put in 
> >> that field and updated back in to the text file. I have searched all over 
> >> google for about 4 hrs looking for something like this but no go, any help 
> >> would be appricated.
> > 
> > This is a simple example but it should work for you:
> > 
> > $new_textcontent = "";
> > 
> > foreach($_POST as $area => $value) {
> >   $new_textcontent .= $area . "=" . $value . "\n";
> > }
> > 
> > $fp = fopen($filename, 'w');
> > fputs($fp, $new_textcontent);
> > fclose($fp);
> > 
> > 
> > 
> >> ----- Original Message ----- From: "Dwight Altman" <dwight@[...].com>
> >> To: "'Rob W.'" <rob@[...].com>; <php-db@[...].net>
> >> Sent: Tuesday, March 14, 2006 9:13 AM
> >> Subject: RE: [PHP-DB] Text file (rw) question...
> >> 
> >> 
> >>> How about posting your solution as well?  Maybe someone will find it 
> >>> useful.
> >>> 
> >>> -----Original Message-----
> >>> From: Rob W. [mailto:rob@[...].com]
> >>> Sent: Tuesday, March 14, 2006 2:07 AM
> >>> To: php-db@[...].net
> >>> Subject: Re: [PHP-DB] Text file (rw) question...
> >>> 
> >>> Nevermind. I figured it out.
> >>> 
> >>> 
> >>> ----- Original Message ----- From: "Rob W." <rob@[...].com>
> >>> To: <php-db@[...].net>
> >>> Sent: Tuesday, March 14, 2006 1:45 AM
> >>> Subject: [PHP-DB] Text file (rw) question...
> >>> 
> >>> 
> >>> I'm trying to figure out how to read specific data from a text file that
> >>> is already written. Example
> >>> 
> >>> MaxUser=3D32
> >>> PortBase=3D8000
> >>> 
> >>> I want to be able to have php read them specific pieces of info so I can
> >>> put them in to forms and update them via php.
> >>> Any help would be appreciated.
> >>> 
> >>> -- 
> >>> 
> >>> -- 
> >>> PHP Database Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>> 
> >>> 
> >>> 
> >> 
> > 
> > 
> > -- 
> > Postgresql & php tutorials
> > http://www.designmagick.com/
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
>  -- 
>  PHP Database Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
> 

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman@[...].com                             http://www.purplecow.com/
---------------------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Rob W.
Rob W.
Chris
Rob W.
Rob W.
Rob W.
Chris
Rob W.
Chris
Rob W.
Chris
Rob W.
Chris
Peter Beckman
Rob W.
Chris
Dwight Altman

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved