// Database details
$dbHost = "internal-db.s36002.gridserver.com";
$dbUser = "db36002_reader";
$dbPass = "yFGUvy5R57";
$dbName = "db36002_site_content";
/*********************************************************
** Function: dbconnect() **
** Desc: Perform database server connection and **
** database selection operations **
*********************************************************/
function dbConnect() {
// Access global variables
global $dbHost;
global $dbUser;
global $dbPass;
global $dbName;
// Attempt to connect to database server
$link = @mysql_connect($dbHost, $dbUser, $dbPass);
// If connection failed...
if (!$link) {
// Inform Flash of error and quit
fail("Couldn't connect to database server");
}
// Attempt to select our database. If failed...
if (!@mysql_select_db($dbName)) {
// Inform Flash of error and quit
fail("Couldn't find database $dbName");
}
return $link;
}
/*********************************************************
** Function: fail() **
** Params: $errorMsg - Custom error information **
** Desc: Report error information back to Flash **
** movie and exit the script. **
*********************************************************/
function fail($errorMsg) {
// Output error information and exit
print $errorMsg;
exit;
}
?>
WordPress › Error