Hi All,
I am trying to connect to a hosted MYSQL database. If I use MYSQL connection code …
[code=php]DEFINE (‘DB_USER’, ‘ff_admin’);
DEFINE (‘DB_PASSWORD’, ‘xxxxx’);
DEFINE (‘DB_HOST’, ‘localhost’);
DEFINE (‘DB_NAME’, ‘ff_data’);
$dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error());
mysql_select_db(DB_NAME) or die (mysql_error());
The connection is successful. If i use the following MYSQLI code … the connection fails
[code=php]$servername = “localhost”;
$username = “ff_admin”;
$password = “xxxxx”;
$database = “ff_data”;
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die(“Connection failed: ” . mysqli_connect_error());
}
echo “Connected successfully”;
The error message shown is …”Connection failed: Access denied for user ‘ff_admin’@’localhost’ (using password: YES)”
I have checked for mysqli_connect support using the below code …
[code=php]echo function_exists(“mysqli_connect”); // outputs 1 for true 0 for false
And obtained a 1. Any ideas why the MYSQL connection works and the MYSQLi doesn’t using the same authentication details?
Many thanks for any help offered.