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]
|