Location: PHPKode > projects > Helpdesk Over Web > how/includes/mysql_connect.php
<?php
// Database Connector Script
// This file contains information for accessing the database.

// Defines constants for accessing the database.
define('DB_USER', 'howdbuser');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('DB_NAME', 'howdb');

if($dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // initiates connection.
	if(!mysql_select_db(DB_NAME)) { // if database not available then handle error...
		rhs_error_handler(mysql_errno(), 'Could not select database: ' . mysql_error());
		// Print error message, include footer and exit.
		echo '<P><FONT COLOR="red">This site is currently experiencing technical difficulties.</font></p>';
		include_once('includes/footer.html');
		exit();
	} // ends mysql_select_db IF function.
} else { // if MySQL server connection failed
		rhs_error_handler(mysql_errno(), 'Could not connect to database: ' . mysql_error());
		// Print error message, include footer and exit.
		echo '<P><FONT COLOR="red">This site is currently experiencing technical difficulties.</font></p>';
		include_once('includes/footer.html');
		exit();
} // ends mysql_connect IF function.

// Function to escape/trim form data.
function escape_data($data) {
	global $dbc;
	if(ini_get('magic_quotes_gpc')) {
		$data = stripslashes($data);
	}
	return mysql_real_escape_string(trim($data), $dbc);
} // end of escape_data function.
?>
Return current item: Helpdesk Over Web