I have the following file called config.php. These are configuration options for a client management system. I need these settings to be editable via the system admin panel. How would I go about storing these values in a database? Would it make sense to have a table called "config" with only one row?

<?php

// System Settings

$system_status = 0; // 0 for active, 1 for locked
$system_status_msg = 'The system is currently inactive. One Aministrators can log in.'; // Modifiable message for when the system as been disabled
$admin_email = 'mk@simplisticstyle.com'; // Set administrator email for PHP Mail Function
$site_url = 'http://localhost'; // Set root location of system
$client_max_upload = 2*1024*1024; // Maximum upload file size for clients
$staff_max_upload = 100*1024*1024; // Maximum upload file size for staff
$contract_max_upload = 5*1024*1024;
$invoice_max_upload = 5*1024*1024;


// Form Validation Settings

$pw_min = 5;

?>

Recommended Answers

All 3 Replies

Why do you want to put all those config options in one row in a table, Instead you can create a table config and add a row for each config, this would make easier to edit the code in later.

if it only one configuration better use define() the constant value.

But if it is editable and you have a lots of clients with different configurations you have to search every username of the clients and apply each row configuration. Meaning your table is not only one row your table is a multiple rows of multiple users.

Ahh that makes more sense thanks guys. I never thought of it that way, lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.