Ignore this post - stupid error on my part

A

Anonymous

Guest
Ignore this post - stupid error on my part that I fixed

First off let me say the following code has worked on two previous servers. Unfortunatly during my lattest server switch something went wrong and now I can't seem to connect to any specific databases.

Here is the part where I connect the user and link id, which does work:

Code:
function db_connect() {
	global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
	global $MYSQL_ERRNO, $MYSQL_ERROR;

	$link_id = mysql_connect('localhost', 'abudabit_abudabi', 'password');
	if(!$link_id) {
		echo "Failed";
		return 0;
	}
	else return $link_id;
}

Anyways, that code works. But then when I try this:

Code:
$currentdb = mysql_select_db('abudabit_atomic');
echo " - $currentdb - <BR>";
I don't get a connection confirmation (true). So I did a little experimentation:

Code:
$db_list = mysql_list_dbs($link_id);

while ($row = mysql_fetch_object($db_list)) {
   echo $row->Database . "\n";
}
This code is an attempt to list all the available databases. It lists nothing.

Now it cPanel says the user DOES have access to the database I created. Has anyone experienced this before? I don't know what's wrong, maybe its something with the configuration of this new server or something. My previous server was a dedicated and this one is virtual because of financial troubles, so I don't have telnet access
Please help, my website has been down for a day.
 
Doh! Never mind. After trying for 2 hours before I posted this, it took me 3 minutes to find out the problem.
 
Back
Top