dmossjr
04-11-2008, 02:33 PM
Hi all -
I'm just learning PHP/SQL, and have created a basic sql connect php script that looks like this:
<?php # Script 8.2) - mysqli_connect.php
DEFINE ('DB_USER', 'user name');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'databasename');
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL:' . mysqli_connect_error() );
The script gives me an error like so:
Could not connect to MySQL:Access denied for user 'username'@'localhost' (using password: YES)
I created a database (the name I use on DB_NAME), and a user name and password which I also put in the fields above.
I've also tried using this format with the values: "sitename_user" and "sitename_password" as I noticed that's how they appear in the database view of the control panel.
Any advice on what's going wrong? Thanks!
I'm just learning PHP/SQL, and have created a basic sql connect php script that looks like this:
<?php # Script 8.2) - mysqli_connect.php
DEFINE ('DB_USER', 'user name');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'databasename');
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL:' . mysqli_connect_error() );
The script gives me an error like so:
Could not connect to MySQL:Access denied for user 'username'@'localhost' (using password: YES)
I created a database (the name I use on DB_NAME), and a user name and password which I also put in the fields above.
I've also tried using this format with the values: "sitename_user" and "sitename_password" as I noticed that's how they appear in the database view of the control panel.
Any advice on what's going wrong? Thanks!