PDA

View Full Version : mysql_connect vs mysql_pconnect


alaios
05-16-2005, 10:59 AM
Goodmoring... I am trying to figure out the difference between the mysql_connect and mysql_pconnect. I have write an object-oriented class in order to connect to the database. I can't find any difference ... any suggestions?

JamieR
05-16-2005, 03:10 PM
mysql_pconnect() acts very much like mysql_connect() with two major differences.

First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).


taken from http://uk.php.net/mysql_pconnect :)

alaios
05-16-2005, 03:52 PM
Thx a lot.. But.... What do u suggest me to use? A connection with mysqlp_connect can also be closed or not?

JamieR
05-16-2005, 04:38 PM
I've always used mysql_connect() and it has been fine for what I needed it for.

alaios
05-16-2005, 04:42 PM
thx a lot... i suppose that u always close your connection after the job is done... I would like to hear more opinions for my question