Location: PHPKode > scripts > MySQL access class > mysql-access-class/config.mysql.inc.php
<?php
/**
* MySQL Database access configurations
* This file must be in the same directory as the parent class.mysql.inc.php is in.
* @author Bimal Poudel
* @copyright 2006, Bimal Poudel
* @package mysql
*/

/**
* @var array Database Connection parameters
*/
$dbinfo = array(); # reset any older settings

/**
* @var string dbindex Get to know, which server index to use.
*/
$dbinfo['dbindex'] = (isset($_SERVER['SERVER_NAME']))?$_SERVER['SERVER_NAME']:((isset($_SERVER['HOSTNAME']))?$_SERVER['HOSTNAME']:"localhost-default");
# Scripts running from the CRON can not have server name.

##################################################################################################
####################[ !THE ONLY MODIFIABLE CODES! ]###############################################
##################################################################################################
/**
* For each possible servers, define the connection parameters.
*/
switch($dbinfo['dbindex'])
{
case 'sitbim.com':
case 'www.sitbim.com':
case 'localhost':
default:
	$dbinfo[$dbinfo['dbindex']]['host']='localhost';
	$dbinfo[$dbinfo['dbindex']]['dbuser']='class';
	$dbinfo[$dbinfo['dbindex']]['dbpassword']='classpassword';
	$dbinfo[$dbinfo['dbindex']]['database']='class_database';
}

/**
* Based on the actual database index, make an acual database connection.
* Everything will be used as a global value.
*/
define('MYSQL_DATABASENAME', $dbinfo[$dbinfo['dbindex']]['database']);
define('MYSQL_CONNECTION', mysql_connect(
	$dbinfo[$dbinfo['dbindex']]['host'],
	$dbinfo[$dbinfo['dbindex']]['dbuser'],
	$dbinfo[$dbinfo['dbindex']]['dbpassword']
))
or die("Cannot connect to the database <STRONG>(".$dbinfo[$dbinfo['dbindex']]['database'].") on ".$dbinfo[$dbinfo['dbindex']]['host']."</STRONG><HR>".mysql_error());

/**
* Use the active mysql database, immediately after the connection is made.
*/
# /* $dbinfo[$dbinfo['dbindex']]['dbcon'] */
/*
mysql_select_db($dbinfo[$dbinfo['dbindex']]['database'], $dbinfo[$dbinfo['dbindex']]['dbcon'])
	or die("Database <strong>(".$dbinfo[$dbinfo['dbindex']]['database'].")</strong> can not be selected.<HR>".mysql_error());
*/
mysql_select_db($dbinfo[$dbinfo['dbindex']]['database'], MYSQL_CONNECTION)
	or die("Database <strong>(".$dbinfo[$dbinfo['dbindex']]['database'].")</strong> can not be selected.<HR>".mysql_error());

#define('MYSQL_CONNECTION', $dbinfo[$dbinfo['dbindex']]['dbcon']);

?>
Return current item: MySQL access class