Local and uploaded database connection, no need to change on upload.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?php error_reporting(E_ALL); ini_set("display_errors", "On"); $host = $_SERVER['HTTP_HOST']; if ($host == 'localhost') { $hostname = 'localhost'; $dbname = 'databasename'; $username = 'root'; $password = ''; } else { $hostname = 'localhost'; $dbname = 'databasename_x1'; $username = 'myusername'; $password = 'x1234tre'; } // Let's connect to host mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!'); mysql_select_db($dbname) or DIE('Database name is not available!'); date_default_timezone_set('Europe/London'); //handy ?> |