As I mentioned your suggestion here does work, however while the example was
simple, the application is very extensive and changing every SQL call is not
possible.
On 8/17/03 4:56 PM this was written:
Try using the SQL to select which database.
example, instead of:
select * from table1
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
Agreed, sounds like a pain. to keep two copies. But if you do it to both
copies, and use the same code both places (connect via URL, not 'localhost'
even if you are on the same machine) then it wouldn't be any extra trouble.
The OS will realize that the URL is localhost and make that connection
Didn't work.
On 8/18/03 11:51 AM this was written:
Same login for remote and local but I wonder if I did create a remote-only
user it will work better.
On 8/18/03 11:33 AM this was written:
Agreed, sounds like a pain. to keep two copies. But if you do it to both
copies, and use the same
I'm not making two connections, I'm making one and only one call to
mysql_connect. Also, there is no way in that function as per the definition
page of it (http://us3.php.net/mysql_connect) to have the database selected
as per your example below.
With my connection though, when I do:
$dbh =
Try using the SQL to select which database.
example, instead of:
select * from table1
use:
select * from database1.table1
if that works, and the php command doesn't that may mean the the mysql client
lib is broken, although, I've been using it with mysql 4 and it seems to work
fine.
Here's the stats:
Two servers:
Server 1, Mysql 4.0.12, PHP 4.3.2, apache 1.3.27
Server 2, Mysql 4.0.14, PHP 4.3.2, apache 1.3.27
My HTTP is setup on Server 2 (and server 1 as well) I'm setting up a mirror
on Server 2 and it connects to the DB on server 1.
Privs are setup that user has DB
If you are doing this:
$dbh = mysql_connect(db1, blah blah blah);
$dbh2 = mysql_connect(db2, blah blah blah);
Then
$r = mysql_query(select * from mytable);
will use the db2 connection, because it is the most recent. However, if
you do this:
$r = mysql_query(select * from mytable, $dbh);
it