August 9th, 2000, 05:46 AM
What is the pro of opening a mysql_pconnect instead of a mysql_connect (speed ?)
August 9th, 2000, 07:06 AM
Yes. pconnect uses an existing connection between the php module and mysql (if there is one). However, connections do not remain persistent unless php is a module.
August 9th, 2000, 07:12 AM
But when should I close the database connection, if I don't close it at the end of the php script ?
And if the database is already open what is the effect of a second mysql_pconnect ?
August 9th, 2000, 09:10 AM
You don't need to worry about closing the connection. If you use mysql_connect() it will automatically close when the script exits. If you use mysql_pconnect() any mysql_close() you use will be ignored.
If a connection already exits, the link id of the current connection will be returned.