Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the best function that can be used to connect to
mysql database and in what cases that we can use below
functions ?

1. mysql_connect()

2. mysql_pconnect()

please give your answer with all pros and cons

Answer Posted / p.sivasankar

1>>mysql_connect() — Open a connection to a MySQL Server

Description:
resource mysql_connect ([ string $server [, string
$username [, string $password [, bool $new_link [, int
$client_flags ]]]]] )
Opens or reuses a connection to a MySQL server

2>>mysql_pconnect — Open a persistent connection to a MySQL
server

Description:
resource mysql_pconnect ([ string $server [, string
$username [, string $password [, int $client_flags ]]]] )

Establishes a persistent connection to a MySQL server.

mysql_pconnect() acts very much like mysql_connect() with
two major differences.

First, when connecting, the function would first try to
find a (persistent) link that's already open with the same
host, username and password. If one is found, an identifier
for it will be returned instead of opening a new
connection.

Second, the connection to the SQL server will not be closed
when the execution of the script ends. Instead, the link
will remain open for future use (mysql_close() will not
close links established by mysql_pconnect()).

This type of link is therefore called 'persistent'

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is var_dump?

963


How do you put a space in html?

945


Can we use include ("xyz.php") two times in a php page "index.php"?

971


Which php mvc framework is best?

976


How do I check if a given variable is empty?

876


Which function is used in php to check the data type of any variable?

892


What is PHP's configuration file called?

1142


What is the difference between pop3 IMAP and MAPI?

1003


What are the uses of php language?

920


Explain me what is the use of 'print' in php?

872


Do csrf tokens expire?

898


What types of loops exist in php?

990


What is the Default syntax used in PHP?

1054


Explain how is it possible to cast types in php?

927


How do we get the current session id?

957