From d6db883e52b62f41c0b8a6e759849c638c04e2cf Mon Sep 17 00:00:00 2001 From: Banana Date: Fri, 1 Jan 2021 15:52:24 +0100 Subject: [PATCH] mysql try catch gorenest --- webclient/lib/gorenest.class.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/webclient/lib/gorenest.class.php b/webclient/lib/gorenest.class.php index f73b010..08fbb42 100644 --- a/webclient/lib/gorenest.class.php +++ b/webclient/lib/gorenest.class.php @@ -79,12 +79,17 @@ class GoreNest { WHERE ".$this->_User->getSQLRightsString()." AND `category` = '".$this->_DB->real_escape_string($category)."' ORDER BY position"; - $query = $this->_DB->query($queryStr); - if($query !== false && $query->num_rows > 0) { - while(($result = $query->fetch_assoc()) != false) { - $this->_menuData[$result['category']][$result['id']] = $result; + try { + $query = $this->_DB->query($queryStr); + if($query !== false && $query->num_rows > 0) { + while(($result = $query->fetch_assoc()) != false) { + $this->_menuData[$result['category']][$result['id']] = $result; + } } } + catch (Exception $e) { + error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage()); + } return $this->_menuData[$category]; } @@ -99,12 +104,17 @@ class GoreNest { $queryStr = "SELECT id, action FROM `".DB_PREFIX."_menu` WHERE ".$this->_User->getSQLRightsString().""; - $query = $this->_DB->query($queryStr); - if($query !== false && $query->num_rows > 0) { - while(($result = $query->fetch_assoc()) != false) { - $ret[$result['action']] = $result['action']; + try { + $query = $this->_DB->query($queryStr); + if($query !== false && $query->num_rows > 0) { + while(($result = $query->fetch_assoc()) != false) { + $ret[$result['action']] = $result['action']; + } } } + catch (Exception $e) { + error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage()); + } return $ret; } -- 2.39.5