I am not using $dbh and $dbh2 I'm only making ONE connection to the
database.  I AM using mysql_query($sql,$dbh) when I make the call.  I am
using mysql_select_db($dbname,$dbh) to do the connection to the database but
it's not selecting the one that I want.  It's choosing another one and I
don't know why!

My statement that the 3.23 server chooses the right one is with another
website setup almost the same way. In fact, the code is the same for both
but the main database server for each is different.  The only difference
between the two is that the one connecting to the 4.x server doesn't
selected the database when the one connecting to the 3.23 server (another
separate website) does select the right one.

On 8/16/03 12:26 AM this was written:

> Oh yeah -- just swap the $dbh and $dbh2 variables on the other server, and
> your code will work both places (the only difference being $dbh is the
> server the code is on, and $dbh2 is the other server).
> 
> I would use the handle in your mysql_query calls, rather than the
> mysql_select_db(); gets too weird.  Just open two connections, one to each
> (if you must) and go from there.
> 
>> From the docs:
> 
> mysql_select_db() sets the current active database on the server that's
> associated with the specified link identifier. If no link identifier is
> specified, the last opened link is assumed. If no link is open, the
> function will try to establish a link as if mysql_connect() was called
> without arguments, and use it.
> 
> Every subsequent call to mysql_query() will be made on the active
> database.
> 
> Peter
> 
> On Fri, 15 Aug 2003, Thomas Deliduka wrote:
> 
>> The ONLY way I  have been able to work around this issue is before I call
>> the SQL query I have to add db1.mytable to every call to the table. I.e.
>> Adding "db1" to the beginnign. Then it works around the call to the wrong
>> database.  This cannot happen all the time. The application is very
>> extensive and the code is shared between sites so I can't just do this.
>> 
>> Does anyone have any clue why even though I'm calling mysql_select_db("db1")
>> it still tries to gather data from "db2"?  This only happens when I'm
>> connecting from Server 2 to server 1 it does not happen any other time.
>> Incidentally it doesn't happen when I'm connecting from server 2 to another
>> server running mySQL 3.23.54 there is no problem at all.
>> 
>> I'm thinking it's a permissions system or something funky with MySQL 4 but I
>> don't know for sure.  Any ideas?
>> 
>> --
>> 
>> Thomas Deliduka
>> IT Manager
>>      -------------------------
>> Xenocast
>> Street Smart Media Solutions
>> http://www.xenocast.com/
>> 
>> 
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> ---------------------------------------------------------------------------
> Peter Beckman                                                  Internet Guy
> [EMAIL PROTECTED]                             http://www.purplecow.com/
> ---------------------------------------------------------------------------
> 

-- 

Thomas Deliduka
IT Manager
     -------------------------
Xenocast
Street Smart Media Solutions
http://www.xenocast.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to