What is mysql pconnect in PHP

In this article I am going to explain about mysql_pconnect function in PHP.
  • 2038

PHP mysql_pconnect() Function

The PHP mysql_pconnect function opens a persistent connection to MySQL database from php script. The advantage of mysql_pconnect over mysql_connect function is that, you do not need to close the connection like mysql_connect function and it also keeps the connection live even the script execution is over.

Syntax of mysql_pconnect function

mysql_pconnect(server, user, pwd, clientflag)

Parameters in mysql_pconnect function

It have four parameter:

Parameter Description
server It specifies mysql server name.
user It specifies username for login.
pwd It specified password for login.
clientflag Clientflag parameter can be combination of many of constants.

Example of mysql_pconnect function





die("Could not connect:".mysql_error());




echo "Connection established successfully";


//Here you do not need to close the connection.




You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.