dual mysql connection
Posted 10 April 2006 - 11:44 PM
I also have it connect to another DB on the same server to get a recent list of posts. Now I included the mysql_connect/pconnect in the function itself but if I place it at the top of the page the SQL data for the initial connection doesn't work and it looks to the second connection for the data.
How would I keep them sepearate? I'm trying to keep everything O.O. so I'd like to keep it at 2 connections max.
Note: I have multiple functions.
Posted 11 April 2006 - 12:32 PM
SELECT * FROM theotherdatabase.tableYou can also maintain two connections by keeping track of the resource returned by mysql_connect().
$conn1 = mysql_connect(...FIRST DATABASE...); $conn2 = mysql_connect(...SECOND DATABASE...); $result = mysql_query(...QUERY FIRST DATABASE..., $conn1); $result2 = mysql_query(...QUERY SECOND DATABASE..., $conn2);
Posted 12 April 2006 - 12:08 AM
And thanks for the tip but they're on the same server but they're two different databases.
One is an Invision Forum database, we'll call it db1_ibrd1, and the other is in another database called news. Does your example only work with column names or for different databases altogether?
Posted 12 April 2006 - 03:37 AM
If they're on the same server AND have the same login credentials, then you can use the fully-qualified DB.TABLE.COLUMN syntax; otherwise, you have to use two different connections, AFAIK.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users