Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 98af6fb

Browse files
author
Ed Rackham
committed
Added method to close connection. Closes #12
1 parent b12f2cc commit 98af6fb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎class.MySQL.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ function MySQL($database, $username, $password, $hostname='localhost'){
6262
// Connects class to database
6363
// $persistant (boolean) - Use persistant connection?
6464
private function Connect($persistant = false){
65-
if($this->databaseLink){
66-
mysql_close($this->databaseLink);
67-
}
65+
$this->CloseConnection();
6866

6967
if($persistant){
7068
$this->databaseLink = mysql_pconnect($this->hostname, $this->username, $this->password);
@@ -312,6 +310,13 @@ function ArrayResultsWithKey($key='id'){
312310
function LastInsertID(){
313311
return mysql_insert_id();
314312
}
313+
314+
// Closes the connections
315+
function CloseConnection(){
316+
if($this->databaseLink){
317+
mysql_close($this->databaseLink);
318+
}
319+
}
315320
}
316321

317322
?>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /