Roxana Posted August 9, 2012 Share Posted August 9, 2012 I once tried and couldn't. I concluded that you probably need to create your tables so that this is not needed. But can you? Was I making some other mistake and in fact it is possible? Link to comment Share on other sites More sharing options...
HartleySan Posted August 9, 2012 Share Posted August 9, 2012 Sure you can. You need to execute the mysqli_connect function twice though and assign the returned objects to two different variables. You are right though, in that if you can just have everything in one DB, that's probably easier. Link to comment Share on other sites More sharing options...
Larry Posted August 9, 2012 Share Posted August 9, 2012 Or, instead of making two connections, you can just switch databases through the open connection. But it's best to use one DB. Link to comment Share on other sites More sharing options...
Edward Posted August 9, 2012 Share Posted August 9, 2012 I was reading stuff about this last night, you can make a database_connections array and store your connections in that one array, then reference each with a key. Link to comment Share on other sites More sharing options...
HartleySan Posted August 9, 2012 Share Posted August 9, 2012 Yes, you can do that for ease of access. I think Facebook does something similar with their Big Pipe implementation, which is essentially a bunch of Ajax objects in an array. Link to comment Share on other sites More sharing options...
oksana Posted September 9, 2012 Share Posted September 9, 2012 $con1 = mysql_connect("localhost","root",""); if (!$con1) { die('Could not connect: ' . mysql_error()); } $con2 = mysql_connect("localhost","root",""); if (!$con2) { die('Could not connect: ' . mysql_error()); } // then connect into 2 databases mysql_select_db('my_database',$con1); mysql_select_db('oops', $con2); Compleate reference that I got is from:-http://wintekweb.blogspot.com/2012/09/run-two-databases-simultaneously.html Link to comment Share on other sites More sharing options...
rob Posted September 9, 2012 Share Posted September 9, 2012 Seriously oksana, it's not obvious at all that you're spamming with other accounts too Larisa ;D lol http://www.larryullman.com/forums/index.php?/topic/1614-chapter-11-file-uploads/#entry9868 1 Link to comment Share on other sites More sharing options...
Edward Posted September 10, 2012 Share Posted September 10, 2012 Seriously oksana, it's not obvious at all that you're spamming with other accounts too Larisa ;D lol http://www.larryullm...oads/#entry9868 Sharp detective work Rob. Link to comment Share on other sites More sharing options...
Recommended Posts