Ashley Sheridan wrote: > On Thu, 2008-10-30 at 08:55 +1100, Chris wrote: > >> Waynn Lue wrote: >> >>> I sent an email to the mysql list, but it reminded me of a question I had >>> for people structuring their PHP code. What's the general way that people >>> structure their connections? Right now, I spawn off two mysql_connect calls >>> at the top of the file that includes my database calls, using "true" for the >>> fourth parameters, so as to create two new connections. Then I use those >>> two connections for two different databases I have to query from. >>> >>> Is it better just to use mysql_select_db within the query function every >>> time for the same connection? Should I use mysql_connect every time without >>> using "true", so as to re-use connections. Should I be using pconnect >>> instead? >>> >>> I spent some time looking for answers to these questions, but am getting >>> conflicting answers. Some people think relying on the re-use of these >>> functions is good, some think that explicit management is better. In >>> general, how have people on the list found them? For example, is having >>> constant mysql_select_db calls a problem? >>> >> Are they connecting as the same user and on the same server? Then you >> can replace with a mysql_select_db call. >> >> If they aren't both of those, you have no choice. >> >> No idea if it'll make much of a difference (performance wise etc) but >> I'd leave it as two connections. >> >> -- >> Postgresql & php tutorials >> http://www.designmagick.com/ >> >> >> > How difficult would it be to converge the 2 databases into one? This > would obviously use less memory (not sure exactly how big the footprint > of each connection is though) and will slightly speed up page display > time (as you only have to wait for one connection to be made rather than > two) > > > Ash > www.ashleysheridan.co.uk > > Generally you want separation of data. MySQL doesn't have a problem accessing another DB on the same server with the same connection. Also, how would database convergence use less memory? . Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php