From 5412fb8a6c4ee57c05d9679e468f5d53a9ac44fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 12 Jul 2011 21:06:17 +0000 Subject: [PATCH] Also this is fixed? --- inc/referal-functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/referal-functions.php b/inc/referal-functions.php index 57b00298b1..5b26ebfab5 100644 --- a/inc/referal-functions.php +++ b/inc/referal-functions.php @@ -624,6 +624,7 @@ function flushReferalTableToDatabase ($userid) { // Prepare SQL $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_user_refs` (`userid`,`level`,`refid`) VALUES '; + $executeSql = false; // Now walk through the array, first levels foreach ($GLOBALS['referal_refid'][$userid] as $level=>$levelArray) { @@ -643,6 +644,9 @@ function flushReferalTableToDatabase ($userid) { if ($count == 0) { // Then add it to the SQL $SQL .= '(' . $userid . ',' . $level . ',' . $refid . '),'; + + // Some has been added, so execute the query + $executeSql = true; } // END - if } // END - foreach } // END - foreach @@ -652,7 +656,9 @@ function flushReferalTableToDatabase ($userid) { // And run it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',SQL=' . $SQL); - SQL_QUERY($SQL, __FUNCTION__, __LINE__); + if ($executeSql === true) { + SQL_QUERY($SQL, __FUNCTION__, __LINE__); + } // END - if //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - EXIT!'); } -- 2.39.5