
PHP: How to system configurations stored in a database and used as constants?
I want to be back in Constants PHP database. Basically, I want to create a page that can update the database table the first time you load the other site, use this new updated constants also be extracted from the database. I look for things can be changed directly by the administrator, without regard entry in the source code and modify the file manually coded Constants.
Make the configuration file and is in settings.php ()
$cfg_server="serveraddress";
$cfg_database="dbname";
$cfg_username="username";
$cfg_password="dbpassword";
?> Now, we can put this in any file you need to access the database include ( "settings.php"); $ link = mysql_connect ( "$ Cfg_server" cfg_password "$ cfg_username", "$") or die ( "Error"); mysql_select_db ( "$ Cfg_database" $ Link) or die ( "Error");