note 37007 added to function.mysql-pconnect
| From: | croban at rn2 dot php dot net | Date: | Thu, 30 Oct 2003 14:57:29 +0000 |
| Subject: | note 37007 added to function.mysql-pconnect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59527@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-pconnect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37007
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37007&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37007&report=yes
Search -- http://master.php.net/manage/user-notes.php