What i'm needing to do is write a config file which i keep in the main www dir.
In this file i'm able to set the mysql db username and pass as long with the site name.
First off. My question is how would i set that inside of the config file?
$sitename = "whatever";
Global $sitename; ?
Once i have it set.. How would be the best way to call those vars from the config file. I.E
include('config.inc');
$_GET['sitename']; ??
Thank you for your time and help and most of all patients.
- Anthony
PHP design question
Moderator: General Moderators
config file with db access
I usually put in an seperate file and then include it in the files i wish to use it in. then you don't need to make it global
$hostname = "localhost" ;
$user = "username" ;
$password = "1234567890" ;
$database = "help_me" ;
$cn=mysql_connect($hostname,$user,$password);
mysql_select_db($database);
include("include_files/dbacc.php");
$hostname = "localhost" ;
$user = "username" ;
$password = "1234567890" ;
$database = "help_me" ;
$cn=mysql_connect($hostname,$user,$password);
mysql_select_db($database);
include("include_files/dbacc.php");