Page is a not externally linkable
LinusIT - 9:43 am on Feb 13, 2013 (gmt 0)
Yeah I intend on having a seperate database for each customer. If I explain the setup hopefully that will clear things up. I'm developing a system which I will sell to multiple customers. The code will be hosted on my domain however the customers database will be hosted on their domain. The thinking behind this is each customers data is their own, it isn't mixed with everyone elses.
The reason I didn't go the way Habtom suggested is because there could be hundreds of config files, meaning allot of if statements.
The content will be different based on the url, only as the data available is dependant on the url/customer database connection.
The code I've posted works however it checks each time, which is not exactly ideal. I've looked into using DEFINE but I'm still not sure I can do it that way.
I think it's just this bit that needs changing
$hostname = $db_ip;
$database = $db_name;
$username = $db_username;
$password = $db_password;
Would something like this work?
DEFINE ("CUST_DB_IP", $db_ip);
DEFINE ("CUST_DB_NAME", $db_name);