Ok normaly I am the one answering but I encountered the oddest of the odd. I have a piece of code below to connect to my database.
$db->mysql_db_connect($config[host], $config[user], $config[pass], $config[db_name]);
This accesses a function I built and it doesn't detect the database. Now this one does work.
$db->mysql_db_connect($config[host], $config[user], $config[pass], "test");
Both of them are accessing this function.
// Connects to MySQl and selects the database
function mysql_db_connect($hostname, $username, $password, $db_name = "test")
{
/* Make the database connection */
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
/* Select the Database we want */
@mysql_select_db($db_name) OR DIE("Unable to select database");
}
This function is within my database class that I setup as an object called db.
The variables I used are below.
/ Variables for Database acess /
$config[host] = "localhost";
$config[user] = "root";
$config[pass] = "littleduck";
$config[db_name] = "test";
Now does anyone see an error in my code? I have worked on it for a half hour and I have had two other experts help me and they have concluded that it might be a bug in the PHP engine.