Hi,
According to me, the connexion is not closed at the end of the function,
but at the end of the script.
I'm using Oracle, but I don't think it's very different.
I've built an abstraction class to manage the database connections and
queries.
I use one method to open the connection and instantiate my objects (that
is my connexions), then other methods to perform queries.
That gives :
Connect = new DB();
Connect->select(....);
With Oracle we also have persistant connections using pconnect : PHP
manage database connexions and don't close them, they are re-used when
needed. I don't know if it exists with MySQL.
Of course opening a new connection for each request in the same script
is really not good ;-). I wouldn't be your database server when traffic
will increase on your site ;-)
Seb |