When you open a MySQL connection with mysql_connect(), it returns a link identifier. But what if you want to get that link identifier again later in the script? (for example: A plug-in, that needs to open a new database connection, and still access the old one.)
I'm looking for a way to return a link identifier to the last connection opened by mysql_connect(). Is there a function that does this?
Even though the explanation of Anti Veeranna is correct, there is a very straight-forward way to do what you want. The docs for mysql_connect()
state that this function has a 4th parameter $new_link
, which is false
by default. If you call mysql_connect()
again with the same parameters, which is probably the case, it would not create a new connection, but instead would return the resource identifier of the old one.
Any time ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With