Forum Moderators: coopster
I've triple checked the database name on the control panel of the server. I'm also assuming that I'm through to the server successfully, as there is no "access denied" error, or any other kind of error after the mysql_connect command.
The database definitely exists, and I can access it in PHPMyAdmin with the username and password which works in the mysql_connect command.
With the following code specified:
<code>
$mysql_database="mydatabase";
$mysql_username="username";
$mysql_password="password";
$link = mysql_connect("33.99.90.27:1103",$mysql_username,$mysql_password) or die ("Unable to connect to SQL server");
</code>
....I've tried the following syntaxes
mysql_select_db($mysql_database, $link) or die ("Unable to select database");
mysql_select_db($mysql_database) or die ("Unable to select database");
mysql_select_db("actual_name", $link) or die ("Unable to select database");
All of them fail to select the database. Either I'm doing something wrong, or the database doesn't exist on that server. But so far all the mistakes have been mine, not the server administrator's, so I'm rather loathe to ask him what to do next.
Can anyone help?
Thanks
mlkarie
Also, if you are on another machine (not the one running the mysql database I mean) could it be a firewall issue?
Does the mysql_error function return anything?
I ran a script containing mysql_list_dbs, and the reply was a humongous list of databases, but without the database that I'm trying to connect to.
This hosting company uses two servers, and I'm connecting to the IP address and port as specified on their control panel.
Either my database is sitting on the other server, or the there is something wrong with the rights.
However, having run mysql_list_dbs and seen what's there, I now feel I can contact the server administrator without feeling stupid, thanks to your help.
BTW, the entire script that I'm using, is as follows:
<?php
$mysql_database="mydb";
$mysql_username="user";
$mysql_password="pword";
$link = mysql_connect("33.23.67.12:5678",$mysql_username,$mysql_password) or die ("Unable to connect to SQL server");
mysql_select_db($mysql_database, $link) or die ("Unable to select database");
?>
How stupid can one get? Maybe it's time for a holiday...