|
Posted by Dave on 05/23/05 05:08
Shelly (sheldonlg@asap-consult.com) decided we needed to hear...
> I have identical names for the database, user and password on the local
> machine and on the remote site. I also have identical tables and info in
> the tables. It works perfectly on the local machine. On the remote site I
> get "No Database Selected". It happens in the mysql_query call.
>
> echo "ssLogin = " . $ssLogin . " ";
> $LoginRS = mysql_query($LoginRS__query, $ssLogin) or die(mysql_error());
> echo "LoginRS = " . $LoginRS;
>
> This gives:
> ssLogin = Resource id #3 No Database Selected
>
> On both machines I have have a require file which is:
>
> <?php
> # FileName="Connection_php_mysql.htm"
> # Type="MYSQL"
> # HTTP="true"
> $hostname_ssLogin = "localhost";
> $database_ssLogin = "the_database_name";
> $username_ssLogin = "the_username";
> $password_ssLogin = "the_password";
> $ssLogin = mysql_pconnect($hostname_ssLogin, $username_ssLogin,
> $password_ssLogin) or die(mysql_error());
> ?>
>
> I thought it might be the $hostname_ssLogin, that it had to be something
> else. However, if it is not localhost, then the mysql_pconnect fails.
>
> Any ideas?
>
> Shelly
>
While your test machine may have only one (default) database, your
remote machine will probably require you to specify which db you
want to use... you can do this right after you connect with a call
such as
$status = mysql_select_db($database_ssLogin, $ssLogin);
As an aside, are you sure your webhost allows persistent connections?
I wouldn't have thought so, but a few might I suppose.
--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)
[Back to original message]
|