PHP : mysql_pconnect() function
Description
The mysql_pconnect() is used to open a persistent connection to a MySQL server.
Version
(PHP 4 and above)
Syntax
mysql_pconnect (server, username, password, client_flags)
Parameters
| Name | Description | Required/ Optional | Type |
|---|---|---|---|
| server | The MySql server. You can use hostname, ip address, hostname:portname, ip address:portname as server. Default is localhost:3306. | Optional | String |
| username | The username. Default value is defined by mysql.default_user. | Optional | String |
| password | The password of the user. Default value is defined by mysql.default_password. | Optional | String |
| client_flags | The client_flags parameter can be a combination of the following constants: MYSQL_CLIENT_SSL - use SSL encryption MYSQL_CLIENT_COMPRESS - use compression protocol MYSQL_CLIENT_IGNORE_SPACE Allow space after function names MYSQL_CLIENT_INTERACTIVE - Allow interactive_timeout seconds (instead of wait_timeout) of inactivity before closing the connection |
Optional | Integer |
Return value
A MySQL persistent link identifier on success, or FALSE on failure.
Value Type : Resource.
Example :
<?php
$con = mysql_pconnect("localhost", "root", "mypass",MYSQL_CLIENT_INTERACTIVE );
if ($con)
{
echo "Connected successfully at : ". date("d/m/y : H:i:s", time());
}
?>
Output :
Connected successfully at : 26/07/10 : 14:15:01
See also

