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

Which cryptographic functions in php returns the longest hash value?

567


How can I learn php fast?

547


How long is csrf token?

531


What type of headers that PHP supports?

608


Is php still in demand?

537






What is session management php?

521


Can I use node js with php?

521


Tell me what type of operation is needed when passing values through a form or an url?

527


What is the use of mysql_real_escape_string in php?

443


How I can control asset documents without GR/IR?

1201


Why do we use php?

530


What is the difference between overloading and overriding in php?

531


Tell me how to initiate a session in php?

541


What is a php object?

501


Which Scripting Engine PHP uses?

550