'Storing configuration in database

I'm having a problem with my application configuration. It's based on KohanaPHP framework, currently I store configuration in custom config file:

$config['status'] = array(
    '1' => 5,
    '2' => 10,
    '3' => 15,
    '4' => 20,
    '5' => 25,
    '6' => 30
);

and then in view/controller (when needed):

$arr = Kohana::config('settings.status'); echo $arr[$item->status]

Now I'm looking for the best method to store such config arrays in database.

What would you recommend? Separate tables? Putting everything in one table? Would you give me a tip?

Cheers, M.



Solution 1:[1]

It depends entirely on how similar/different these arrays are. Normally, I'd say you create separate tables with an Id, Value and potentially a sort order. You'd create a separate table for each of these, because these arrays are unrelated even though they may have the same structure.

However, I cannot tell by far what this array of yours does. Maybe it's better to just leave it in the config file, unless you want to refer to it from other database records.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wolf