SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loading config details from Mysql into config object

    My config is currently stored in a text file as an object. However I would prefer it if I could load the config details (apart from the mysql settings) from a table thats looks like this:

    Code:
    config_var | config_value
    site_name | Example
    site_url | http://www.example.com
    etc
    I want to load that into a config object so I can access the config variables like this:

    PHP Code:
    $config->site_name 
    As that's how the rest of the site access the config variables at the moment.

    Is there an easy way to do this?
    hmm...

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could just create a load_config() function in your object, and have the constructor call it, or put it in the constructor.

    query your database, and assign the values to your object.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •