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

What is mysql_fetch_array?

736


Why php is used with mysql?

776


Which function parses an English textual date or time into Unix timestamp in PHP.

788


Define soundex()?

693


How to create a public static method in PHP?

765


What are the differences between PHP3 and PHP4 and PHP5? what is the current stable version of PHP?

871


Is a number php?

749


How to access a global variable inside a function?

743


What is baseurl?

728


What does $_env mean?

774


What is php call function?

694


Can we use onclick in submit button?

767


How do you trim spaces in excel?

768


How to create an empty array in php?

838


What is basic php?

745