Permalink
Browse files

Explicitly close database connection, rather than waiting for connect…

…ion to time out
  • Loading branch information...
1 parent 9f064a3 commit b378ecc9cf3a29d20ff64a6f909f7f450b8d9edb @pezholio committed Jun 22, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −2 distance.php
  2. +2 −2 postcode.php
View
@@ -1,7 +1,7 @@
<?php
require_once("db.php");
-mysql_connect('localhost', $db_username, $db_password);
+$link = mysql_connect('localhost', $db_username, $db_password);
mysql_select_db($db_name) or die(mysql_error());
if ($_GET['postcode']) {
@@ -41,4 +41,5 @@
header ("content-type: text/html");
include("result.php");
}
-?>
+
+mysql_close($link);
View
@@ -5,7 +5,7 @@
require_once("json.php");
//require_once("electoraldistrict.php");
-mysql_connect('localhost', $db_username, $db_password);
+$link = mysql_connect('localhost', $db_username, $db_password);
mysql_select_db($db_name) or die(mysql_error());
if ($_GET['postcode']) {
@@ -176,4 +176,4 @@
header ("content-type: text/html");
include("result.php");
}
-
+mysql_close($link);

0 comments on commit b378ecc

Please sign in to comment.