Hi, How can mysql_select_db be used to open 2 databases? I want to open 2 databases and then grab a table from each of them and join them together in a SELECT statement.
hmmm, u could do something like this: $username="something"; $pasword="whatever"; $database="youdatabase"; $username2="something2"; $pasword2="whatever2"; $database2="youdatabase2"; mysql_connect(localhost,$username,$password, localhost, $username2, $password2); @mysql_select_db($database, $database2) or die ( "unable to connect"); PHP: but on second thought that probably wouldnt work. y not just open it 2 times? what exactly are you trying to do?
Yeah I think mysql_select_db can only open one DB at a time so it would need to be repeated twice (correct me if i'm wrong). I ended up doing things a different way now. It's too hard to explain because there's a lot of code involved Thanks for your help anyway.
You cant actually select 2 different database on 1 connection. If you want to access them both youll need to run mysql_connect twice, or else select the new db each time you want to use it.