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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.