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
How do you end php?
How to connect to a url in php?
Why is used in php?
What is the difference between file_get_contents() and file_put_contents() in php?
How to convert a json string to an array in php?
How do I find out the number of parameters passed into function9?
How do I get csrf token?
How to create an array in php?
What is purpose of @ in Php?
What are magic constants in php?
How do I see how many pages per session in google analytics?
How to execute an sql query? How to fetch its result?
Can we override static method in php?
How long does a php session last for?
How to set session.gc_divisor properly?