From 502cf2a81510d17fa0cafb4d8af1b869bff96c11 Mon Sep 17 00:00:00 2001 From: Banana Date: Fri, 1 Jan 2021 16:11:30 +0100 Subject: [PATCH] mysql try catch trie --- webclient/lib/trite.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webclient/lib/trite.class.php b/webclient/lib/trite.class.php index 3edfd7d..7a2ea8b 100644 --- a/webclient/lib/trite.class.php +++ b/webclient/lib/trite.class.php @@ -165,13 +165,18 @@ class Trite { LEFT JOIN `".DB_PREFIX."_group` AS g ON `c`.`group` = `g`.`id` WHERE ".$this->_User->getSQLRightsString("read", "c")." ORDER BY `c`.`name`"; - $query = $this->_DB->query($queryStr); + try { + $query = $this->_DB->query($queryStr); - if($query !== false && $query->num_rows > 0) { - while(($result = $query->fetch_assoc()) != false) { - $ret[$result['id']] = $result; + if($query !== false && $query->num_rows > 0) { + while(($result = $query->fetch_assoc()) != false) { + $ret[$result['id']] = $result; + } } } + catch (Exception $e) { + error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage()); + } return $ret; } -- 2.39.5