What is the advantge and disadvantage of mysql_connet() and
mysql_pconnect() ? in which condition will you use
mysql_connect() and mysql_pconnect().

Answer Posted / praveen

mysql_pconnect() will maintain a persistent connection to
the database. whenever your script calls the connect to
database function, it first searches already existing
connections to the database and if exists it will use the
same connection to connect to the database, if not it will
open a new connection to the database. ie. Connection is
Persistent

where as mysql_connect() function will establish a new
connection whenever a connection to database needed, and
after executing the script, this function disconnects the
connection. ie. connection is not a persistent one.

mysql_pconnect() function is used where your site has a
Heavy Traffic and where as mysql_connect() function is used
when there is moderate/less traffic to your site.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I find my php version?

543


Tell me how to set a page as a home page in a php based site?

512


Can php run without apache?

548


What are the different opening and closing tags available in PHP?

575


Why laravel is best php framework?

547






What is meant by pdo in php?

552


What does session start do in php?

509


What is a path Traversal?

557


What is Different between Joomla And Magento?

2275


What are different types of Print Functions available in PHP?

530


Tell me how can we determine whether a variable is set?

509


What is the method to register a variable into a session?

488


Explain the purpose of output buffering in php.

512


Write a program to find the factorial of a number in php?

528


What is super keyword in php?

522