How to remove IF condition from this code ?
For some weird reason this code only works when correct database credentials are inside ELSE statement. If I have correct database credentials in IF statement connection wont work. What is going on ? :)
<?php
/* database connection */
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
define('DBUSER', 'User1');
define('DBPASS', 'password2');
define('DBHOST', 'localhost');
define('DBNAME', 'selector');
} else {
define('DBUSER', 'User2');
define('DBPASS', 'password1');
define('DBHOST', 'localhost');
define('DBNAME', 'Database');
}
define('DB', 'mysql:host=' . DBHOST . ';dbname=' . DBNAME);