I am doing a freelance project for someone who unfortunately knows nothing about his system, platform, anything. He is not even sure of the hosting provider he's under! He knows of the original webmaster who did his site (he did it entirely in Flash!) and that's all; he can't even reach this guy.
Anyway he wants to be able to add dynamic capabilities to his site and I found out, on my own, that he can accept PHP. Problem is, I can't be sure of his database connectivity other than that he has MySQL.
This is the code I wrote thus far to try to figure out things:
$dbConn = mysql_connect("$dbHost:$dbPort", $dbUser, $dbPwd);
print_r("<P>Database resource link after not existing within DBConnection Object: ");
print_r($dbConn); // PRINTS OUT AN ACTUAL RESOURCE LINK
if (!$dbConn) die('Could not connect to db: ' . mysql_error());
mysql_select_db('mysql', $dbConn);
print_r("<P>Error after attempting to connect to 'mysql' db: " . mysql_error() . "<P>"); // I GET A "DENIED ACCESS TO USER" ERROR
$sql = 'CREATE DATABASE IF NOT EXISTS hgf';
mysql_query($sql, $dbConn);
print_r(mysql_error() . "<P>");
mysql_select_db($dbDefaultName, $dbConn);
print_r(mysql_error() . "<P>");
mysql_disconnect($dbConn);
I am a bit unsure as to how he can connect using mysql_connect() but unable to select the default 'mysql' database after successful connection due to an 'access denied" error. That makes no sense to me but maybe someone else can clarify.
Thanx
Phil