<?php
define('DEVELOPMENT', 'localhost');
define('PRODUCTION', '');
$message = "";
switch ($_SERVER['SERVER_NAME']) {
case DEVELOPMENT:
// Condition for localhost server
$localhost = "localhost";
$username = "root";
$password = "";
$database = "test";
break;
default:
// live server
$localhost = "Enter live hostname";
$username = "Enter live username";
$password = "Enter live password";
$database = "Enter live database name";
break;
}
$GLOBALS['connection'] = new mysqli($localhost, $username, $password, $database);
if($GLOBALS['connection'])
{
echo "connected";
}
else{
echo mysqli_error();
}
?>
No comments:
Post a Comment