Jump to content

need some php magic


radar

Recommended Posts

Okay I have a table in my database called config...  this table has 2 cells.. one called config_name and the other config_value...

Well I need to be able to write to this via a form... The only thing thats ever going to change is config_value -- so how do I take the contents of the form and put it into the database?

Only way i could think of would be to do every query individually.. which would suck...  then i thought someone here might now a bit about doing something like this.. so let me know.. and thanks in advance...
Link to comment
https://forums.phpfreaks.com/topic/19080-need-some-php-magic/
Share on other sites

I guess that would have been a good thing to include...  there will be multiple entries.. and here is a sample take on it..

config_name    config_value
domainname    www.mysiste.com
site_name        My Web Site
site_descrip      the elitest of the elite
site_enable      1
req_act            0
req_vis_act      1

It is in that type of setup... goes on an on  holds all the important configuration of my site in this table....
Link to comment
https://forums.phpfreaks.com/topic/19080-need-some-php-magic/#findComment-82586
Share on other sites

I'd use an ini file format

config.php[code]
domainname=www.mysiste.com
site_name=My Web Site
site_descrip=the elitest of the elite
site_enable=1
req_act=0
req_vis_act=1 [/code]

To read it

[code]$config = parse_ini_file('config.php', false);[/code]

$config now is an array

[code]Array
(
    [domainname] => www.mysiste.com
    [site_name] => My Web Site
    [site_descrip] => the elitest of the elite
    [site_enable] => 1
    [req_act] => 0
    [req_vis_act] => 1
)
[/code]

echo $config['site_name']  --> 'My Web Site' ;
Link to comment
https://forums.phpfreaks.com/topic/19080-need-some-php-magic/#findComment-82646
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.