You are here: Re: [PHP] Connecting To Multiple MySQL Databases « PHP « IT news, forums, messages
Re: [PHP] Connecting To Multiple MySQL Databases

Posted by John Holmes on 10/04/14 11:07

NathanielGuy#21 wrote:
> I know this may be slightly off topic for a PHP listserv but I cant
> find my answer anywhere else. I start off generating a page connected
> to one database as a certain user and I call a script that requires a
> connection to a second database as a different user. Is there any way
> I could open that connection while maintaining the current one aswell?
> The connection of the script is opend and closed before any more of
> the other page is generated. Im not sure how to go about solving this
> problem other than rewriting my script. Any ideas?

Yes, it's possible. That's why mysql_connect() returns a connection
resource. So assign the result of each mysql_connect() to a different
variable so you can keep them apart. It's also why mysql_query() accepts
a connection parameter, so you can designate which connection the query
is being sent to.

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация