Sr. PHP Programmer Question:
Download Questions PDF

Difference between mysql_connect and mysql_pconnect?

Answer:

There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , 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... 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.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
How will you close a MySql database using PHP?How will you retrieve the error message using Exception class in PHP when error occured?