Milos
Milos

Reputation: 143

Store application config variables to database

Is there any PHP open source class that can store application configuration variables in MySQL database, like Wordpress for example? I would like to store and read something like this:

$config['name'] = "test1";
$config['name']['subname'] = "test2";

in MySQL database table, and database table need to look something like this

Id | Name      | Value   | Parent Name Id |
1  | 'name'    | 'test1' | null           |
2  | 'subname' | 'test2' | 1              |

etc.

Upvotes: 0

Views: 68

Answers (1)

Star_Man
Star_Man

Reputation: 1091

That need not have a class style. For example:

//config.php

    $config['name'] = "test1";
    $config['name']['subname'] = "test2";

//other php.

    require_once('{path to config.php}');
    echo $config['name'];
    echo $config['name']['subname'];

Upvotes: 1

Related Questions