aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php/lib/db.php6
-rw-r--r--php/lib/mirror.php2
2 files changed, 5 insertions, 3 deletions
diff --git a/php/lib/db.php b/php/lib/db.php
index 6882064..34e49e3 100644
--- a/php/lib/db.php
+++ b/php/lib/db.php
@@ -7,8 +7,8 @@
class DB {
- private $dsn;
- private $result;
+ private static $dbh;
+ private static $result;
/**
* Connect to a MySQL database server.
* @param string $host db server, defaults to localhost
@@ -20,7 +20,7 @@ public static function connect($host='localhost',$user=null,$password=null,$data
{
if (!empty($host) && isset($user) && isset($password)) {
$dsn = "mysql:host={$host}";
- if(!empty($database)) $dsn .= ";database={$database}";
+ if(!empty($database)) $dsn .= ";dbname={$database}";
$options = [PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
static::$dbh = new PDO($dsn, $user, $password, $options);
}
diff --git a/php/lib/mirror.php b/php/lib/mirror.php
index ac3e904..564e33f 100644
--- a/php/lib/mirror.php
+++ b/php/lib/mirror.php
@@ -530,3 +530,5 @@ public static function get_product_stats()
mirror_locations.product_id
");
}
+
+}