View Single Post
  #4  
Old 05-08-2006, 09:21 AM
PlanetWebHost PlanetWebHost is offline
WHT Addict
 
Join Date: Oct 2001
Location: Mountain Home Arkansas
Posts: 131
I use muliple databases all the time, and you don't really need to switch between them, just open them with different resource id's, and specify the resource link identifer in your queries. ( I accually always write my queries that way, incase I need to connect to a different database later on in development )


PHP Code:
$db1  mysql_connect('localhost','myuserid','mypasswd');  
$sel1 mysql_select_db('db01'); 
$db2  mysql_connect('localhost','myuserid','mypasswd');  
$sel2mysql_select_db('db02'); 

$res1 mysql_query($query$db1);
$res2 mysql_query($query$db2); 
note: then you also need to use the resource link idenitifier in functions like, mysql_affected_rows($db1), mysql_insert_id($db1), mysql_error($db1), etc...

__________________
rocket science is more fun when you accually have rockets!