What is the difference between mysql_connect() and mysql_pconnect()?
mysql_connect() and mysql_pconnect() provide the same functionality and used to connect with mysql database in php
when mysql_connect() function called then its try to find the persistent link, its try because might be the connection is open and if its find then use the same connection and if not found then new connection establish. when you use mysql_close() will close links established by mysql_connect() function. so you need to call it again if you want to use.
When mysql_pconnect() function called then its open a persistent connection to a MySQL server. when this function is called the connection to the MySQL server will not be closed once the execution of the script ends, the connection will remain open for future use. when you use mysql_close() will not close links established by mysql_pconnect() function.
The following are the differences between mysql_connect() and mysql_pconnect()
1) Using mysql_connect() function, a new connection is opened to the database, while using mysql_pconnect() function its opens a persistant connection to the database.
2) mysql_close() function can be used to close the opened connection, where as mysql_pconnect can not close the connection even you use the mysql_close() function.
3) Database is opened every time when the page is loaded by mysql_connect. Whereas by using mysql_pconnect, database need not be connected every time.