]> git.mxchange.org Git - mailer.git/blobdiff - inc/referral-functions.php
Use countSumTotalData() instead of SQL query
[mailer.git] / inc / referral-functions.php
index 20b3da01690ebee3faaeb6300f7f129fecf48f36..1b95e84ee9c49cd3ee8cc1090f0e4b7e9a36923d 100644 (file)
@@ -699,12 +699,7 @@ function flushReferralTableToDatabase ($userid) {
                foreach ($levelArray as $refid) {
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . $refid);
                        // Query the user_refs table
-                       list($count) = SQL_FETCHROW(SQL_QUERY_ESC('SELECT COUNT(`id`) AS `count` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`=%s AND `refid`=%s LIMIT 1',
-                               array(
-                                       $userid,
-                                       $level,
-                                       $refid
-                               ), __FUNCTION__, __LINE__));
+                       $count = countSumTotalData(bigintval($userid), 'user_refs', 'id', 'userid', TRUE, ' AND `level`=' . bigintval($level) . ' AND `refid`=' . bigintval($refid));
 
                        // Is there no entry?
                        if ($count == 0) {