note 69063 added to function.mysql-close
| From: | RonS at osu1 dot php dot net | Date: | Mon, 21 Aug 2006 23:38:42 +0000 |
| Subject: | note 69063 added to function.mysql-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116143@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 216.194.113.175
Probable Submitter: 70.20.26.37
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mysql-close.php
Edit -- https://master.php.net/note/edit/69063
Del: integrated -- https://master.php.net/note/delete/69063/integrated
Del: useless -- https://master.php.net/note/delete/69063/useless
Del: bad code -- https://master.php.net/note/delete/69063/bad+code
Del: spam -- https://master.php.net/note/delete/69063/spam
Del: non-english -- https://master.php.net/note/delete/69063/non-english
Del: in docs -- https://master.php.net/note/delete/69063/in+docs
Del: other reasons-- https://master.php.net/note/delete/69063
Reject -- https://master.php.net/note/reject/69063
Search -- https://master.php.net/manage/user-notes.php