What is the difference between MySQL_connect and MySQL_pconnect?

Mysql_connect:

  • It opens a new connection to the database.
  • Every time you need to open and close the database connection, depending on the request.
  • Opens page whenever it is loaded.

Mysql_pconnect:

  • In Mysql_pconnect, “p” stands for persistent connection, so it opens the persistent connection.
  • The database connection cannot be closed.
  • It is more useful if your site has more traffic because there is no need to open and close connection frequently and whenever the page is loaded.