note 37007 deleted from function.mysql-pconnect by vincent
| From: | vincent@php.net | Date: | Thu, 30 Oct 2003 14:58:58 +0000 |
| Subject: | note 37007 deleted from function.mysql-pconnect by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59528@lists.php.net to get a copy of this message | ||
Note Submitter: croban
----
Hi
does have somebody problemms with pconnect because every time whan i refresh page he makes a new
connection to MySql DB but he dont close the old one.
Thill now i haven't this problemm but we upgrade a Mysql to 4.0.16 and now we have all the time
100 connections :((
is that a bug from PHP, MYSql or our.
function connect($Database = "", $Host = "", $User = "", $Password =
"") {
/* Handle defaults */
if ("" == $Database)
$Database = $this->Database;
if ("" == $Host)
$Host = $this->Host;
if ("" == $User)
$User = $this->User;
if ("" == $Password)
$Password = $this->Password;
/* establish connection, select database */
if ( 0 == $this->Link_ID ) {
$this->Link_ID=mysql_pconnect($Host, $User, $Password);
if (!$this->Link_ID) {
$this->halt("pconnect($Host, $User, \$Password) failed.");
return 0;
}
if (!@mysql_select_db($Database,$this->Link_ID)) {
$this->halt("cannot use database ".$this->Database);
return 0;
}
}
return $this->Link_ID;
}