note 69063 deleted from function.mysql-close by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Jun 2009 13:53:14 +0000 |
| Subject: | note 69063 deleted from function.mysql-close by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156980@lists.php.net to get a copy of this message | ||
Note Submitter: RonS
----
I just got caught with the "connection to the same database" issue. I need to do a lookup
to a master database for syncing issues, but there was a possibility a conenction to the master
could be open elsewhere. When I closed "my connection" it closed the "other
connection" as well.
My goodness, this violates every principle in modern programming technique. All functions
can't possibly be smart enough to know if there is an existing connection to a database, and
who the user is and all other parameters.
It is, however, good programming practice to close your database connections after you're done
with them, a practice that I'll have to avoid allowing the program's termination to close
the db since I can't tell if the return from mysql_connect() has given me my own resource or a
pre-existing one. Absolutely preposterous.
Since this is the lowest-level access to the database in the language, it should do as requested.