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 the difference server side and browser side validation?

694


What is strlen function in php?

735


/temp is a type of filesystem directory. State Whether True or False?

767


How to create reusable code in php?

751


Does php need a closing tag?

706


What Is a Persistent Cookie?

791


How to fix "headers already sent" error in php

731


What is php limit?

712


What is php ci?

772


What is basename php?

706


What does sign mean php?

747


What are php variables?

718


What is substr() in php? And how it is used?

739


How does the identity operator ===compare two values in PHP?

842


What are the features of object-oriented programming in php?

691