I have this config file.
<?PHP
$s_ipserver1 = "10.0.0.101";
$db_porta1 = "3306";
$db_user1 = "user";
$db_password1 = "123456";
$db_name1 = "name";
$s_ipserver2 = "xxx.xxx.xxx.xxx";
$db_porta2 = "3306";
$db_user2 = "user";
$db_password2 = "123456";
$db_name2 = "name";
$s_ipserver3 = "xxx.xxx.xxx.xxx";
$db_porta3 = "3306";
$db_user3 = "user";
$db_password3 = "123456";
$db_name3 = "name";
?>
And I want to make it something like this.
<?PHP
$dbL = "1";// Que servidor é este? 1, 2 ou 3.
$s_ipserver1 = "10.0.0.101";
$db_porta1 = "3306";
$db_user1 = "user";
$db_password1 = "123456";
$db_name1 = "name";
$s_ipserver2 = "xxx.xxx.xxx.xxx";
$db_porta2 = "3306";
$db_user2 = "user";
$db_password2 = "123456";
$db_name2 = "name";
$s_ipserver3 = "xxx.xxx.xxx.xxx";
$db_porta3 = "3306";
$db_user3 = "user";
$db_password3 = "123456";
$db_name3 = "name";
$s_ipserver = "$s_ipserver$dbL";
$db_porta = "$db_porta$dbL";
$db_user = "$db_user$dbL";
$db_password = "$db_password$dbL";
$db_name = "$db_name$dbL";
?>
This is one of the connection files.
<?PHP
include_once("/pasta/config.php");
$db_host1 = "$s_ipserver1:$db_porta1";
$db_link1 = mysql_connect($db_host1, $db_user1, $db_password1) or die (mysql_error ());
$db_connect1 = mysql_select_db($db_name1, $db_link1);
?>
I need something like this.
<?PHP
include_once("/pasta/config.php");
$db_host = "$s_ipserver:$db_porta";
$db_link = mysql_connect($db_host, $db_user, $db_password) or die (mysql_error ());
$db_connect = mysql_select_db($db_name, $db_link);
?>
Where is my error? All original files are working perfectly.