RE: [PHP] working with ini files

2006-02-28 Thread Jim Moseby
 
 I have created my own ini file. I can read the values into an array  
 fine. but What I want to do is change a value in the ini file. Example
 
 file.ini
 dog = 3
 cat = 4
 fish = 7
 
 altered file.ini
 dog = 3
 cat = 5
 fish = 7
 
 how can I do this, I tried using ini_set but its not working.
 help would be great, Thanks!!


ini_set is for manipulating PHP.ini settings.  Try this:

http://codewalkers.com/seecode/138.html

JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] working with ini files

2006-02-28 Thread jblanchard
[snip]
I have created my own ini file. I can read the values into an array  
fine. but What I want to do is change a value in the ini file. Example

file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7
[/snip]

ini_set is for the php.ini, not yours. You will need to open and write
to your ini file. http://www.php.net/fopen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working with ini files

2006-02-28 Thread Aleksandar Skodric
May I presume that your ini file is just simple plain text file? Check 
then how you can use PHP to handle files:


http://nl2.php.net/manual/en/function.file.php
http://nl2.php.net/manual/en/function.fopen.php
http://nl2.php.net/manual/en/function.fwrite.php

Although, I suggest creating such things in database, if you have that 
option.


Regards,
Aleksandar

Benjamin Adams wrote:
I have created my own ini file. I can read the values into an array 
fine. but What I want to do is change a value in the ini file. Example


file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7

how can I do this, I tried using ini_set but its not working.
help would be great, Thanks!!
Ben


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working with ini files

2006-02-28 Thread Adam Ashley
On Tue, 2006-02-28 at 13:32 -0500, Benjamin Adams wrote:
 I have created my own ini file. I can read the values into an array  
 fine. but What I want to do is change a value in the ini file. Example
 
 file.ini
 dog = 3
 cat = 4
 fish = 7
 
 altered file.ini
 dog = 3
 cat = 5
 fish = 7
 
 how can I do this, I tried using ini_set but its not working.
 help would be great, Thanks!!
 Ben

As has been mentioned ini_set is for php.ini values. You can do what you
want with fopen and all that manually or check out
http://pear.php.net/package/Config all the hard work has been done for
you.

Adam Ashley


signature.asc
Description: This is a digitally signed message part