From 5074cbfc5f6b0a3d76628becfc8a69a1174fc998 Mon Sep 17 00:00:00 2001 From: ruan Date: Tue, 4 Oct 2016 02:36:26 +0200 Subject: [PATCH] Fixed more possible error instances --- inc/header.php | 1 + inc/page.php | 4 +++- inc/settings.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/header.php b/inc/header.php index b02c3bb..309465f 100644 --- a/inc/header.php +++ b/inc/header.php @@ -19,6 +19,7 @@ function __construct($page) { (SELECT COUNT(*) FROM $t_warnings) AS c_warnings, (SELECT COUNT(*) FROM $t_kicks) AS c_kicks"); ($row = $st->fetch(PDO::FETCH_ASSOC)) or die('Failed to fetch row counts.'); + $st->closeCursor(); $this->count = array( 'bans.php' => $row['c_bans'], 'mutes.php' => $row['c_mutes'], diff --git a/inc/page.php b/inc/page.php index aaa7806..a5eb88c 100644 --- a/inc/page.php +++ b/inc/page.php @@ -401,7 +401,9 @@ class Page { $where = $this->where_append($this->name === "kicks" ? "" : $this->settings->active_query); $where .= "(uuid <> '#offline#' AND uuid IS NOT NULL)"; - $result = $this->conn->query("SELECT COUNT(*) AS count FROM $table $where")->fetch(PDO::FETCH_ASSOC); + $st = $this->conn->query("SELECT COUNT(*) AS count FROM $table $where"); + $result = $st->fetch(PDO::FETCH_ASSOC); + $st->closeCursor(); $total = $result['count']; } diff --git a/inc/settings.php b/inc/settings.php index 93b0131..d7ba078 100644 --- a/inc/settings.php +++ b/inc/settings.php @@ -143,6 +143,7 @@ final class Settings { $st = $this->conn->query("SELECT * FROM " . $this->table['servers'] . " LIMIT 1;"); $st->fetch(); + $st->closeCursor(); } catch (PDOException $e) { Settings::handle_error($this, $e); }