X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fearning_functions.php;h=a1bb9a79f74048f3cf3d1fd00acc67111eb89349;hb=023d240bd9154811e5ebca23892ed06fefc72c08;hp=3f747490bfa1fd97e3aa5250c057ecf301444c42;hpb=596c8ab32594401ca84abfbfe35513ddfff31bec;p=mailer.git diff --git a/inc/libs/earning_functions.php b/inc/libs/earning_functions.php index 3f747490bf..a1bb9a79f7 100644 --- a/inc/libs/earning_functions.php +++ b/inc/libs/earning_functions.php @@ -87,18 +87,8 @@ function generateMemberEarningDataTable ($earningProvider) { // Handle earning id function doMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { - // Does the user already have this earning? - $result = SQL_QUERY_ESC("SELECT COUNT(`id`) AS `cnt` FROM `{?_MYSQL_PREFIX?}_user_earning` WHERE `earning_id`=%s AND `earning_userid`=%s LIMIT 1", - array( - bigintval($earningId), - getMemberId() - ), __FUNCTION__, __LINE__); - - // Get the count - list($count) = SQL_FETCHROW($result); - // Does the user have this? - if ($count == 1) { + if (countSumTotalData(bigintval($earningId), 'user_earning', 'id', 'earning_id', TRUE, ' AND `earning_userid`=' . getMemberId()) == 1) { // Then update it $status = updateMemberEarning($earningId, $dailyAmount, $isActive); } else { @@ -106,9 +96,6 @@ function doMemberEarning ($earningId, $dailyAmount, $isActive = 'Y') { $status = insertMemberEarning($earningId, $dailyAmount, $isActive); } - // Free result - SQL_FREERESULT($result); - // Return status return $status; }