diff --git a/bans.php b/bans.php index ad48c9b..67df508 100644 --- a/bans.php +++ b/bans.php @@ -10,8 +10,8 @@ $page->print_check_form(); $page->table_begin(); -$result = $page->run_query(); -while ($row = $result->fetch(PDO::FETCH_ASSOC)) { +$rows = $page->run_query(); +foreach ($rows as $row) { $player_name = $page->get_name($row['uuid']); if ($player_name === null) continue; diff --git a/inc/page.php b/inc/page.php index bddbb21..368bf88 100644 --- a/inc/page.php +++ b/inc/page.php @@ -135,9 +135,11 @@ class Page { $st->execute(); + $rows = $st->fetchAll(); + $st->closeCursor(); - return $st; + return $rows; } catch (PDOException $ex) { Settings::handle_error($this->settings, $ex); } @@ -221,12 +223,16 @@ class Page { $history = $this->settings->table['history']; $stmt = $this->conn->prepare("SELECT name FROM $history WHERE uuid=? ORDER BY date DESC LIMIT 1"); + $result = null; + if ($stmt->execute(array($uuid)) && $row = $stmt->fetch()) { - $banner = $row['name']; - $this->uuid_name_cache[$uuid] = $banner; - return $banner; + $name = $row['name']; + $this->uuid_name_cache[$uuid] = $name; + $result = $name; } $stmt->closeCursor(); + if ($result !== null) return $result; + $this->uuid_name_cache[$uuid] = null; return null; } diff --git a/kicks.php b/kicks.php index 8623862..ef6e734 100644 --- a/kicks.php +++ b/kicks.php @@ -10,8 +10,8 @@ $page->print_check_form(); $page->table_begin(); -$result = $page->run_query(); -while ($row = $result->fetch(PDO::FETCH_ASSOC)) { +$rows = $page->run_query(); +foreach ($rows as $row) { $player_name = $page->get_name($row['uuid']); if ($player_name === null) continue; diff --git a/mutes.php b/mutes.php index c751577..406666b 100644 --- a/mutes.php +++ b/mutes.php @@ -10,8 +10,8 @@ $page->print_check_form(); $page->table_begin(); -$result = $page->run_query(); -while ($row = $result->fetch(PDO::FETCH_ASSOC)) { +$rows = $page->run_query(); +foreach ($rows as $row) { $player_name = $page->get_name($row['uuid']); if ($player_name === null) continue; diff --git a/warnings.php b/warnings.php index bc29e03..bcd46c0 100644 --- a/warnings.php +++ b/warnings.php @@ -10,8 +10,8 @@ $page->print_check_form(); $page->table_begin(); -$result = $page->run_query(); -while ($row = $result->fetch(PDO::FETCH_ASSOC)) { +$rows = $page->run_query(); +foreach ($rows as $row) { $player_name = $page->get_name($row['uuid']); if ($player_name === null) continue;