From debae8f094aff954bd0c75a6cde068fe22b17c7b Mon Sep 17 00:00:00 2001 From: Shadow Date: Sat, 21 Dec 2013 10:13:44 +0200 Subject: [PATCH] Update db_MYSQL.php --- GameEngine/Database/db_MYSQL.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 065a2573..1cd3ee44 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -1209,12 +1209,25 @@ class MYSQL_DB { return mysql_query($q, $this->connection); } - function DeleteCat($id) { - $qs = "DELETE from " . TB_PREFIX . "forum_cat where id = '$id'"; - $q = "DELETE from " . TB_PREFIX . "forum_topic where cat = '$id'"; - mysql_query($qs, $this->connection); - return mysql_query($q, $this->connection); - } + function DeleteCat($id) { + $qs = "DELETE from " . TB_PREFIX . "forum_cat where id = '$id'"; + $q = "DELETE from " . TB_PREFIX . "forum_topic where cat = '$id'"; + $q2="SELECT id from ".TB_PREFIX."forum_topic where cat ='$id'"; + $result = mysql_query($q2, $this->connection); + if (!empty($result)) { + $array=$this->mysql_fetch_all($result); + foreach($array as $ss) { + $this->DeleteSurvey($ss['id']); + } + } + mysql_query($qs, $this->connection); + return mysql_query($q, $this->connection); + } + + function DeleteSurvey($id) { + $qs = "DELETE from " . TB_PREFIX . "forum_survey where topic = '$id'"; + return mysql_query($qs, $this->connection); + } function DeleteTopic($id) { $qs = "DELETE from " . TB_PREFIX . "forum_topic where id = '$id'";