From: Banana Date: Fri, 1 Jan 2021 14:52:24 +0000 (+0100) Subject: mysql try catch gorenest X-Git-Tag: 1.0~37 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=d6db883e52b62f41c0b8a6e759849c638c04e2cf;p=bibliotheca-php.git mysql try catch gorenest --- 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; }