Cant Connect to Database

Status
Not open for further replies.

jimme12

New Member
Messages
3
Reaction score
0
Points
0
When i try connect to database (i know this is a very simple part but dunno why just cant get it to work)

This is the error i get:

Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'admin'@'stoli.x10hosting.com' (using password: YES) in /home/jimme13/public_html/includes/mysql_connect.php on line 15
Could not connect to MySQL: Access denied for user 'admin'@'stoli.x10hosting.com' (using password: YES)

Anyone can see where i stuffed up?

This is my mysql_connect.php code check where i stuffed up pls. thank you in advanced
HTML:
<?php # Script 14.1 - mysql_connect.php

// This file contains the database access information for the database. 
// This file also establishes a connection to MySQL and selects the database.

// Set the database access information as constants.
define ('DB_USER', 'admin');
define ('DB_PASSWORD', 'Admin101');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'USERS');

// Make the connnection and then select the database.

// Improved MySQL Version:
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );

/* Standard MySQL Version:
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
*/

// Create a function for escaping the data.
function escape_data ($data) {
	
	// Address Magic Quotes.
	if (ini_get('magic_quotes_gpc')) {
		$data = stripslashes($data);
	}
	
	// Improved MySQL Version:
	global $dbc;
	$data = mysqli_real_escape_string($dbc, trim($data));
	
	/* Standard MySQL Version:
	// Check for mysql_real_escape_string() support.
	if (function_exists('mysql_real_escape_string')) {
		global $dbc; // Need the connection.
		$data = mysql_real_escape_string (trim($data), $dbc);
	} else {
		$data = mysql_escape_string (trim($data));
	} */

	// Return the escaped value.	
	return $data;

} // End of function.
?>
 

Starshine

Legend Killer
Messages
14,423
Reaction score
0
Points
0
I believe its because MySQL is now on a separate server and not "localhost". I tried to find the thread that Corey started related to this, but can't for the life of me.
 
Status
Not open for further replies.
Top